[spalenque] - #7812 *WIP

This commit is contained in:
santipalenque 2014-12-04 11:39:08 -03:00 committed by Sebastian Marcet
parent 8228a5d2ea
commit 80b440be52
1 changed files with 17 additions and 3 deletions

View File

@ -51,6 +51,17 @@ jQuery(document).ready(function($) {
return count >0; return count >0;
},'You must add at least one Affiliation.'); },'You must add at least one Affiliation.');
jQuery.validator.addMethod('checkGender', function(value, element,params) {
var gender = $("input[name='Gender']:checked").val();
if (gender) {
if (gender == 'Specify') {
return ($.trim($("input[name='GenderSpecify']").val()) != '');
}
} else {
return false;
}
},'Please specify your gender.');
jQuery.validator.addMethod( jQuery.validator.addMethod(
"regex", "regex",
function(value, element, regexp) { function(value, element, regexp) {
@ -86,7 +97,7 @@ jQuery(document).ready(function($) {
'Password[_Password]': {required: true,minlength: 5}, 'Password[_Password]': {required: true,minlength: 5},
'Password[_ConfirmPassword]': {required: true,minlength: 5,equalTo: '#Password-_Password'}, 'Password[_ConfirmPassword]': {required: true,minlength: 5,equalTo: '#Password-_Password'},
'Affiliations':{checkAffiliations:true}, 'Affiliations':{checkAffiliations:true},
'Gender':{required:true} 'Gender':{checkGender:true}
}, },
messages: { messages: {
FirstName:{ FirstName:{
@ -106,8 +117,7 @@ jQuery(document).ready(function($) {
required:'Primary Email Address is required.', required:'Primary Email Address is required.',
email:'Primary Email Address is not valid.', email:'Primary Email Address is not valid.',
remote:'That address is already in use by another user' remote:'That address is already in use by another user'
}, }
Gender:'Please specify your gender'
} }
}); });
@ -125,6 +135,10 @@ jQuery(document).ready(function($) {
} }
}); });
GenderSpecify.on('change',function(){
$("label.error[for='Gender']").remove();
});
registration_form.submit(function(event){ registration_form.submit(function(event){
var data_source = $("#AffiliationEditForm_AffiliationEditForm").affiliations('local_datasource'); var data_source = $("#AffiliationEditForm_AffiliationEditForm").affiliations('local_datasource');
$(form_id+"_Affiliations").val(JSON.stringify(data_source)); $(form_id+"_Affiliations").val(JSON.stringify(data_source));