Add validation for email notifications before submit

master
Daniel Berteaud 10 years ago
parent 333fcd8a0f
commit 22cd6c3e3d
  1. 17
      public/js/vroom.js

@ -174,6 +174,7 @@ function addEmailInputField(val){
currentEntry = parentEl.find('.email-entry:last'),
newEntry = $(currentEntry.clone()).appendTo(parentEl);
newEntry.find('input').val(val);
newEntry.removeClass('has-error');
adjustAddRemoveEmailButtons();
}
// Adjust add and remove buttons foir email notifications
@ -252,6 +253,22 @@ $('#configureRoomForm').submit(function(e){
return false;
}
}
var validEmail = true;
$('.email-list').find('input').each(function(index, input){
if (!$(input).val().match(/\S+@\S+\.\S+/)){
$(input).parent().addClass('has-error');
//$(input).parent().notify(locale.ERROR_MAIL_INVALID, 'error');
validEmail = false;
// Break the each loop
return false;
}
else{
$(input).parent().removeClass('has-error');
}
});
if (!validEmail){
return false;
}
var locked = $('#lockedSet').bootstrapSwitch('state'),
askForName = $('#askForNameSet').bootstrapSwitch('state'),
joinPass = ($('#joinPassSet').bootstrapSwitch('state')) ?

Loading…
Cancel
Save