Removing alerts from the front end when adding or editing attendees.
Using inline error messages.
// Check for id and email
if ( account.validEmail !== true ) {
// If not found then nothing was found for that email.
- alert('Must be a valid email address!');
+ app.sendAlertMessage( '#add-attendee-form-message', 'Must be a valid email address!' );
} else if ( account.id !== undefined && account.email !== undefined ) {
var regRequest = cart.get( 'request' );
this.model.registrants.create({
var country = ( this.$('.reg_country').val() ) ? this.$('.reg_country').val().trim(): '';
var isValidEmail = app.isValidEmail( email );
if ( !isValidEmail && email ) {
- alert( 'Email must be valid' );
+ app.sendAlertMessage( '.edit-attendee-form-message', 'Email must be valid' );
this.$('.reg_email').val('');
return;
}
var rTime = null;
}
if ( app.timeSpecific && !rTime ) {
- alert( 'You must select a time!' );
+ app.sendAlertMessage( '.edit-attendee-form-message', 'You must select a time!' );
return;
}
if ( fname === '' || lname === '' ) {
- alert( 'First and Last name required!' );
+ app.sendAlertMessage( '.edit-attendee-form-message', 'First and Last name required!' );
return;
}
// Validate the model
return;
}
if ( fname === '' || lname === '' ) {
- alert( 'First and Last name required!' );
+ app.sendAlertMessage( '#add-attendee-form-message', 'First and Last name required!' );
// Hide the loading graphic
this.$('#loading-' + this.model.get('id') ).hide();
return;
}
var isValidEmail = app.isValidEmail( email );
if ( !isValidEmail ) {
- alert( 'Email must be valid' );
+ app.sendAlertMessage( '#add-attendee-form-message', 'Email must be valid' );
this.$('.add_reg_email').val('');
return;
}
}
var isValidEmail = app.isValidEmail( email );
if ( !isValidEmail ) {
- alert( 'Email must be valid' );
+ app.sendAlertMessage( '#search-account-form-message', 'Email must be valid' );
this.$('.lookup_email').val('');
return;
} else {
this.$('.add_reg_state').val(account.state);
this.$('.add_reg_zip').val(account.zip);
this.$('.add_reg_country').val(account.country);
- // alert( 'Account Found' );
this.$('.account-lookup').hide();
} else {
// Notify them nothing found
- alert( 'Could not find account' );
+ app.sendAlertMessage( '#search-account-form-message', 'Could not find account' );
this.$('.add_reg_email').val(email);
}
})
// Check for id and email
if ( account.validEmail !== true ) {
// If not found then nothing was found for that email.
- alert('Must be a valid email address!');
+ app.sendAlertMessage( '#add-attendee-form-message', 'Must be a valid email address!' );
} else if ( account.id !== undefined && account.email !== undefined ) {
var regRequest = cart.get( 'request' );
this.model.registrants.create({
var country = ( this.$('.reg_country').val() ) ? this.$('.reg_country').val().trim(): '';
var isValidEmail = app.isValidEmail( email );
if ( !isValidEmail && email ) {
- alert( 'Email must be valid' );
+ app.sendAlertMessage( '.edit-attendee-form-message', 'Email must be valid' );
this.$('.reg_email').val('');
return;
}
var rTime = null;
}
if ( app.timeSpecific && !rTime ) {
- alert( 'You must select a time!' );
+ app.sendAlertMessage( '.edit-attendee-form-message', 'You must select a time!' );
return;
}
if ( fname === '' || lname === '' ) {
- alert( 'First and Last name required!' );
+ app.sendAlertMessage( '.edit-attendee-form-message', 'First and Last name required!' );
return;
}
// Validate the model
return;
}
if ( fname === '' || lname === '' ) {
- alert( 'First and Last name required!' );
+ app.sendAlertMessage( '#add-attendee-form-message', 'First and Last name required!' );
// Hide the loading graphic
this.$('#loading-' + this.model.get('id') ).hide();
return;
}
var isValidEmail = app.isValidEmail( email );
if ( !isValidEmail ) {
- alert( 'Email must be valid' );
+ app.sendAlertMessage( '#add-attendee-form-message', 'Email must be valid' );
this.$('.add_reg_email').val('');
return;
}
}
var isValidEmail = app.isValidEmail( email );
if ( !isValidEmail ) {
- alert( 'Email must be valid' );
+ app.sendAlertMessage( '#search-account-form-message', 'Email must be valid' );
this.$('.lookup_email').val('');
return;
} else {
this.$('.add_reg_state').val(account.state);
this.$('.add_reg_zip').val(account.zip);
this.$('.add_reg_country').val(account.country);
- // alert( 'Account Found' );
this.$('.account-lookup').hide();
} else {
// Notify them nothing found
- alert( 'Could not find account' );
+ app.sendAlertMessage( '#search-account-form-message', 'Could not find account' );
this.$('.add_reg_email').val(email);
}
})
<div>
<div>
<div class="row account-lookup">
+ <div id="search-account-form-message" class="columns small-12 text-right glm-reg-required glm-hidden">
+ Message...
+ </div>
<div class="columns small-12">
Search for Existing Account
</div>
<div class="columns small-12 text-right glm-reg-required">
* Required Fields
</div>
+ <div id="add-attendee-form-message" class="columns small-12 text-right glm-reg-required glm-hidden">
+ Message...
+ </div>
<div class="columns small-12"> </div>
</div>
<div class="row">
<div class="columns small-12 text-right glm-reg-required">
* Required Fields
</div>
+ <div class="edit-attendee-form-message columns small-12 text-right glm-reg-required glm-hidden">
+ Message...
+ </div>
<div class="columns small-12"> </div>
</div>
<div class="row">
attendeePlurCapTerm: '{$terms.reg_term_attendee_plur_cap}',
attendeeCapTerm: '{$terms.reg_term_attendee_cap}',
eventCapTerm: '{$terms.reg_term_event_cap}',
+ sendAlertMessage: function( messageArea, message ){
+ jQuery( messageArea ).html( message ).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500);
+ },
checkForMaxAttendees: function(){
if ( app.attendeeMaxPerReg ) {
// Here we need to see how many registrants total in each class.