blob: a13c976745c8da4f6825131c488f5db51a693910 [file] [log] [blame]
jQuery(document).ready(function() {
$('#donateForm').bootstrapValidator({
message: 'This value is not valid',
feedbackIcons: {
valid: 'fa fa-check-square',
invalid: 'fa fa-minus-square',
validating: 'fa fa-refresh'
},
fields: {
first_name: {
message: 'The username is not valid',
validators: {
notEmpty: {
message: 'The first name is required and cannot be empty'
},
stringLength: {
min: 2,
max: 30,
message: 'The first name must be more than 2 and less than 30 characters long'
},
regexp: {
regexp: /^[a-zA-Z0-9_]+$/,
message: 'The first name can only consist of alphabetical, number and underscore'
}
}
},
last_name: {
message: 'The username is not valid',
validators: {
notEmpty: {
message: 'The last name is required and cannot be empty'
},
stringLength: {
min: 2,
max: 30,
message: 'The last name must be more than 2 and less than 30 characters long'
},
regexp: {
regexp: /^[a-zA-Z0-9_]+$/,
message: 'The last name can only consist of alphabetical, number and underscore'
}
}
},
amount: {
message: 'The amount is not valid',
validators: {
notEmpty: {
message: 'The amount is required and cannot be empty'
},
stringLength: {
min: 1,
max: 10,
message: 'The amount must be less than 10 characters long'
},
regexp: {
regexp: /^[0-9]+$/,
message: 'The amount can only consist number'
}
}
},
item_number: {
validators: {
remote: {
url: 'ajaxBugzilla.php?v2',
data: function(validator) {
return {
email: validator.getFieldElements('item_number').val()
};
},
message: 'The eclipse.org login does not exist'
},
emailAddress: {
message: 'The input is not a valid email address'
}
}
}
}
});
});