Created
May 26, 2016 19:47
-
-
Save taiebb/cf8e8e66304b25cf2b7f382cedfe8ad0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var FormValidation = function () { | |
// basic validation | |
var handleValidation1 = function () { | |
// for more info visit the official plugin documentation: | |
// http://docs.jquery.com/Plugins/Validation | |
var form1 = $('#frm_createAccount'); | |
form1.validate({ | |
errorElement: 'span', //default input error message container | |
errorClass: 'help-block help-block-error', // default input error message class | |
focusInvalid: false, // do not focus the last invalid input | |
ignore: "", // validate all fields including form hidden input | |
messages: { | |
'account[username]': { | |
required: 'Ce champ est obligatoire.', | |
minlength: jQuery.validator.format("Au moins {0} caractères") | |
}, | |
'account[email]': { | |
required: 'Ce champ est obligatoire.', | |
email: 'Veuillez entrer un email valide' | |
}, | |
'account[plainPassword][first]': { | |
required: 'Ce champ est obligatoire.', | |
minlength: jQuery.validator.format("Au moins {8} caractères") | |
}, | |
'account[plainPassword][second]': { | |
required: 'Ce champ est obligatoire.', | |
minlength: jQuery.validator.format("Au moins {8} caractères") | |
}, | |
'account[roles][]': { | |
required: 'Ce champ est obligatoire.' | |
} | |
}, | |
rules: { | |
'account[username]': { | |
minlength: 3, | |
required: true | |
}, | |
'account[email]': { | |
required: true, | |
email: true | |
}, | |
'account[adminProfile][firstName]': { | |
required: false | |
}, | |
'account[adminProfile][lastName]': { | |
required: false | |
}, | |
'account[adminProfile][file]': { | |
required: false | |
}, | |
'account[adminProfile][tel]': { | |
required: false | |
}, | |
'account[plainPassword][first]': { | |
required: true, | |
minlength: 8 | |
}, | |
'account[plainPassword][second]': { | |
required: true, | |
minlength: 8 | |
}, | |
'account[roles][]': { | |
required: true | |
} | |
} | |
}); | |
} | |
var handleValidationEditAccount = function () { | |
// for more info visit the official plugin documentation: | |
// http://docs.jquery.com/Plugins/Validation | |
var form1 = $('#frm_frm_editAccount'); | |
form1.validate({ | |
errorElement: 'span', //default input error message container | |
errorClass: 'help-block help-block-error', // default input error message class | |
focusInvalid: false, // do not focus the last invalid input | |
ignore: "", // validate all fields including form hidden input | |
messages: { | |
'account[username]': { | |
required: 'Ce champ est obligatoire.', | |
minlength: jQuery.validator.format("Au moins {0} caractères") | |
}, | |
'account[email]': { | |
required: 'Ce champ est obligatoire.', | |
email: 'Veuillez entrer un email valide' | |
}, | |
'account[plainPassword][first]': { | |
minlength: jQuery.validator.format("Au moins {8} caractères") | |
}, | |
'account[plainPassword][second]': { | |
minlength: jQuery.validator.format("Au moins {8} caractères") | |
}, | |
'account[roles][]': { | |
required: 'Ce champ est obligatoire.' | |
} | |
}, | |
rules: { | |
'account[username]': { | |
minlength: 3, | |
required: true | |
}, | |
'account[email]': { | |
required: true, | |
email: true | |
}, | |
'account[adminProfile][firstName]': { | |
required: false | |
}, | |
'account[adminProfile][lastName]': { | |
required: false | |
}, | |
'account[adminProfile][file]': { | |
required: false | |
}, | |
'account[adminProfile][tel]': { | |
required: false | |
}, | |
'account[plainPassword][first]': { | |
required: false, | |
minlength: 8 | |
}, | |
'account[plainPassword][second]': { | |
required: false, | |
minlength: 8 | |
}, | |
'account[roles][]': { | |
required: true | |
} | |
} | |
}); | |
} | |
var handleValidationEditAccountAdmin = function () { | |
// for more info visit the official plugin documentation: | |
// http://docs.jquery.com/Plugins/Validation | |
var form1 = $('#frm_editAccountAdmin'); | |
form1.validate({ | |
errorElement: 'span', //default input error message container | |
errorClass: 'help-block help-block-error', // default input error message class | |
focusInvalid: false, // do not focus the last invalid input | |
ignore: "", // validate all fields including form hidden input | |
messages: { | |
'admin_profile[username]': { | |
required: 'Ce champ est obligatoire.' | |
}, | |
'admin_profile[email]': { | |
required: 'Ce champ est obligatoire.', | |
email: 'Veuillez entrer un email valide' | |
}, | |
'admin_profile[current_password]': { | |
required: 'Ce champ est obligatoire.' | |
} | |
}, | |
rules: { | |
'admin_profile[username]': { | |
required: true | |
}, | |
'admin_profile[email]': { | |
required: true, | |
email: true | |
}, | |
'admin_profile[current_password]': { | |
required: true | |
}, | |
'admin_profile[adminProfile][firstName]': { | |
required: false | |
}, | |
'admin_profile[adminProfile][lastName]': { | |
required: false | |
}, | |
'admin_profile[adminProfile][tel]': { | |
required: false | |
}, | |
'admin_profile[adminProfile][file]': { | |
required: false | |
}, | |
'admin_profile[enabled]': { | |
required: false | |
} | |
} | |
}); | |
} | |
var handleValidationEditPasswordAccountAdmin = function () { | |
// for more info visit the official plugin documentation: | |
// http://docs.jquery.com/Plugins/Validation | |
var form1 = $('#frm_editPasswordAdmin'); | |
form1.validate({ | |
errorElement: 'span', //default input error message container | |
errorClass: 'help-block help-block-error', // default input error message class | |
focusInvalid: false, // do not focus the last invalid input | |
ignore: "", // validate all fields including form hidden input | |
messages: { | |
'admin_change_password[current_password]': { | |
required: 'Ce champ est obligatoire.' | |
}, | |
'admin_change_password[new][first]': { | |
required: 'Ce champ est obligatoire.', | |
minlength: jQuery.validator.format("Au moins {8} caractères") | |
}, | |
'admin_change_password[new][second]': { | |
required: 'Ce champ est obligatoire.', | |
minlength: jQuery.validator.format("Au moins {8} caractères") | |
} | |
}, | |
rules: { | |
'admin_change_password[current_password]': { | |
required: true | |
}, | |
'admin_change_password[new][first]': { | |
required: true, | |
minlength: 8 | |
}, | |
'admin_change_password[new][second]': { | |
required: true, | |
minlength: 8 | |
} | |
} | |
}); | |
} | |
var handleWysihtml5 = function () { | |
if (!jQuery().wysihtml5) { | |
return; | |
} | |
if ($('.wysihtml5').size() > 0) { | |
$('.wysihtml5').wysihtml5({ | |
"stylesheets": ["../../../../assets/global/plugins/bootstrap-wysihtml5/wysiwyg-color.css"] | |
}); | |
} | |
} | |
var handleValidationEditContact = function () { | |
// for more info visit the official plugin documentation: | |
// http://docs.jquery.com/Plugins/Validation | |
var form1 = $('#frm_editContact'); | |
form1.validate({ | |
errorElement: 'span', //default input error message container | |
errorClass: 'help-block help-block-error', // default input error message class | |
focusInvalid: false, // do not focus the last invalid input | |
ignore: "", // validate all fields including form hidden input | |
messages: { | |
'contact[email]': { | |
required: 'Ce champ est obligatoire.', | |
email: 'Veuillez entrer un email valide' | |
}, | |
'contact[tel]': { | |
required: 'Ce champ est obligatoire.' | |
}, | |
'contact[adresse]': { | |
required: 'Ce champ est obligatoire.', | |
minlength: jQuery.validator.format("Please select at least {0} types of Service") | |
}, | |
'contact[longitude]': { | |
required: 'Ce champ est obligatoire.' | |
}, | |
'contact[latitude]': { | |
required: 'Ce champ est obligatoire.' | |
} | |
}, | |
rules: { | |
'contact[email]': { | |
email: true, | |
required: true | |
}, | |
'contact[tel]': { | |
required: true | |
}, | |
'contact[adresse]': { | |
required: true, | |
minlength: 5, | |
maxlength: 150 | |
}, | |
'contact[latitude]': { | |
required: true | |
}, | |
'contact[longitude]': { | |
required: true | |
} | |
} | |
}); | |
} | |
var handleValidationContactUs = function () { | |
// for more info visit the official plugin documentation: | |
// http://docs.jquery.com/Plugins/Validation | |
var form1 = $('#frm_Contactus'); | |
form1.validate({ | |
errorElement: 'span', //default input error message container | |
errorClass: 'help-block help-block-error', // default input error message class | |
focusInvalid: false, // do not focus the last invalid input | |
ignore: "", // validate all fields including form hidden input | |
messages: { | |
'contact_us[email]': { | |
email: 'Votre email n\'est pas valide.', | |
required: 'Ce champ est obligatoire.' | |
}, | |
'contact_us[subject]': { | |
required: 'Ce champ est obligatoire.' | |
}, | |
'contact_us[name]': { | |
required: 'Ce champ est obligatoire.' | |
}, | |
'contact_us[message]': { | |
required: 'Ce champ est obligatoire.', | |
minlength: jQuery.validator.format('Votre message doit être au moins {0} caractéres'), | |
maxlength: jQuery.validator.format('Votre message doit être au max {0} caractéres') | |
} | |
}, | |
rules: { | |
'contact_us[email]': { | |
email: true, | |
required: true | |
}, | |
'contact_us[subject]': { | |
required: true | |
}, | |
'contact_us[message]': { | |
required: true, | |
minlength: 10, | |
maxlength: 500 | |
}, | |
'contact_us[name]': { | |
required: true | |
} | |
} | |
}); | |
} | |
var handleValidationPartner = function () { | |
var form1 = $('#frm_partner'); | |
form1.validate({ | |
errorElement: 'span', //default input error message container | |
errorClass: 'help-block help-block-error', // default input error message class | |
focusInvalid: false, // do not focus the last invalid input | |
ignore: "", // validate all fields including form hidden input | |
messages: { | |
'partner[name]': { | |
required: 'Ce champ est obligaoire' | |
}, | |
'partner[website]': { | |
url: 'Votre url n\'est pas valide' | |
}, | |
'partner[file]': { | |
required: 'Ce champ est obligaoire' | |
} | |
}, | |
rules: { | |
'partner[name]': { | |
required: true | |
}, | |
'partner[file]': { | |
required: true | |
}, | |
'partner[website]': { | |
required: false, | |
url: true | |
}, | |
'partner[alt]': { | |
required: false | |
} | |
} | |
}); | |
} | |
var handleValidationTeamMember = function () { | |
var form1 = $('#frm_teamMember'); | |
form1.validate({ | |
errorElement: 'span', //default input error message container | |
errorClass: 'help-block help-block-error', // default input error message class | |
focusInvalid: false, // do not focus the last invalid input | |
ignore: "", // validate all fields including form hidden input | |
messages: { | |
'team_member[firstName]': { | |
required: 'Ce champ est obligaoire' | |
}, | |
'team_member[lastName]': { | |
required: 'Ce champ est obligaoire' | |
}, | |
'team_member[function]': { | |
required: 'Ce champ est obligaoire' | |
} | |
}, | |
rules: { | |
'team_member[firstName]': { | |
required: true | |
}, | |
'team_member[lastName]': { | |
required: true | |
}, | |
'team_member[function]': { | |
required: true | |
}, | |
'team_member[alt]': { | |
required: false | |
}, | |
'team_member[file]': { | |
required: false | |
}, | |
'team_member[enabled]': { | |
required: false | |
} | |
} | |
}); | |
} | |
var handleValidationCountry = function () { | |
var form1 = $('#frm_country'); | |
form1.validate({ | |
errorElement: 'span', //default input error message container | |
errorClass: 'help-block help-block-error', // default input error message class | |
focusInvalid: false, // do not focus the last invalid input | |
ignore: "", // validate all fields including form hidden input | |
messages: { | |
'country[name]': { | |
required: 'Ce champ est obligaoire' | |
} | |
}, | |
rules: { | |
'country[name]': { | |
required: true | |
} | |
} | |
}); | |
} | |
var handleValidationCity = function () { | |
var form1 = $('#frm_city'); | |
form1.validate({ | |
errorElement: 'span', //default input error message container | |
errorClass: 'help-block help-block-error', // default input error message class | |
focusInvalid: false, // do not focus the last invalid input | |
ignore: "", // validate all fields including form hidden input | |
messages: { | |
'city[name]': { | |
required: 'Ce champ est obligatoire' | |
}, | |
'city[country]': { | |
required: 'Ce champs est obligatoire' | |
} | |
}, | |
rules: { | |
'city[name]': { | |
required: true | |
}, | |
'city[country]': { | |
required: true | |
} | |
} | |
}); | |
} | |
var handleValidationPostalCode = function () { | |
var form1 = $('#frm_postalCode'); | |
form1.validate({ | |
errorElement: 'span', //default input error message container | |
errorClass: 'help-block help-block-error', // default input error message class | |
focusInvalid: false, // do not focus the last invalid input | |
ignore: "", // validate all fields including form hidden input | |
messages: { | |
'postal_code[cp]': { | |
required: 'Ce champ est obligatoire' | |
}, | |
'postal_code[city]': { | |
required: 'Ce champs est obligatoire' | |
} | |
}, | |
rules: { | |
'postal_code[cp]': { | |
required: true | |
}, | |
'postal_code[city]': { | |
required: true | |
} | |
} | |
}); | |
} | |
var handleValidationFormation = function () { | |
var form1 = $('#frm_formation'); | |
form1.validate({ | |
errorElement: 'span', //default input error message container | |
errorClass: 'help-block help-block-error', // default input error message class | |
focusInvalid: false, // do not focus the last invalid input | |
ignore: "", // validate all fields including form hidden input | |
messages: { | |
'formation[school]': { | |
required: 'Ce champ est obligatoire' | |
}, | |
'formation[country]': { | |
required: 'Ce champ est obligatoire' | |
}, | |
'formation[type]': { | |
required: 'Ce champ est obligatoire' | |
}, | |
'formation[startYear]': { | |
required: 'Ce champ est obligatoire' | |
}, | |
'formation[endYear]': { | |
required: 'Ce champ est obligatoire' | |
}, | |
'formation[grade]': { | |
required: 'Ce champ est obligatoire' | |
}, | |
'formation[status]': { | |
required: 'Ce champ est obligatoire' | |
}, | |
'formation[schoolFieldOfStudy]': { | |
required: 'Ce champ est obligatoire' | |
}, | |
}, | |
rules: { | |
'formation[school]': { | |
required: true | |
}, | |
'formation[country]': { | |
required: true | |
}, | |
'formation[type]': { | |
required: true | |
}, | |
'formation[startYear]': { | |
required: true | |
}, | |
'formation[endYear]': { | |
required: true | |
}, | |
'formation[schoolFieldOfStudy]': { | |
required: true | |
}, | |
'formation[grade]': { | |
required: true | |
}, | |
'formation[status]': { | |
required: true | |
}, | |
'formation[schoolActivities]': { | |
required: false | |
}, | |
'formation[mention]': { | |
required: false | |
}, | |
'formation[description]': { | |
required: false | |
} | |
} | |
}); | |
} | |
var handleValidationExperience = function () { | |
var form1 = $('#frm_experience'); | |
form1.validate({ | |
errorElement: 'span', //default input error message container | |
errorClass: 'help-block help-block-error', // default input error message class | |
focusInvalid: false, // do not focus the last invalid input | |
ignore: "", // validate all fields including form hidden input | |
messages: { | |
'experience[comanyName]': { | |
required: 'Ce champ est obligatoire' | |
}, | |
'experience[title]': { | |
required: 'Ce champ est obligatoire' | |
}, | |
'experience[startDateMonth]': { | |
required: 'Ce champ est obligatoire' | |
}, | |
'experience[startDateYear]': { | |
required: 'Ce champ est obligatoire' | |
}, | |
'experience[endDateMonth]': { | |
required: 'Ce champ est obligatoire' | |
}, | |
'experience[endDateYear]': { | |
required: 'Ce champ est obligatoire' | |
}, | |
'experience[location]': { | |
required: 'Ce champ est obligatoire' | |
}, | |
'experience[sector]': { | |
required: 'Ce champ est obligatoire' | |
}, | |
'experience[postType]': { | |
required: 'Ce champ est obligatoire' | |
} | |
}, | |
rules: { | |
'experience[comanyName]': { | |
required: true | |
}, | |
'experience[title]': { | |
required: true | |
}, | |
'experience[startDateMonth]': { | |
required: true | |
}, | |
'experience[startDateYear]': { | |
required: true | |
}, | |
'experience[endDateMonth]': { | |
required: true | |
}, | |
'experience[endDateYear]': { | |
required: true | |
}, | |
'experience[location]': { | |
required: true | |
}, | |
'experience[description]': { | |
required: false | |
}, | |
'experience[sector]': { | |
required: true | |
}, | |
'experience[postType]': { | |
required: true | |
}, | |
'experience[regime]': { | |
required: false | |
} | |
} | |
}); | |
} | |
var handleValidationStudyLevel = function () { | |
var form1 = $('#frm_studyLevel'); | |
form1.validate({ | |
errorElement: 'span', //default input error message container | |
errorClass: 'help-block help-block-error', // default input error message class | |
focusInvalid: false, // do not focus the last invalid input | |
ignore: "", // validate all fields including form hidden input | |
messages: { | |
'study_level[name]': { | |
required: 'Ce champ est obligatoire' | |
} | |
}, | |
rules: { | |
'study_level[name]': { | |
required: true | |
} | |
} | |
}); | |
} | |
var handleValidationWebSiteConfig = function () { | |
var form1 = $('#frm_webSiteConfig'); | |
form1.validate({ | |
errorElement: 'span', //default input error message container | |
errorClass: 'help-block help-block-error', // default input error message class | |
focusInvalid: false, // do not focus the last invalid input | |
ignore: "", // validate all fields including form hidden input | |
messages: { | |
'website_config[title]': { | |
required: 'Ce champ est obligatoire' | |
}, | |
'website_config[summary]': { | |
required: 'Ce champ est obligatoire' | |
} | |
}, | |
rules: { | |
'website_config[title]': { | |
required: true | |
}, | |
'website_config[summary]': { | |
required: true | |
}, | |
'website_config[alt]': { | |
required: false | |
}, | |
'website_config[fb]': { | |
required: false | |
}, | |
'website_config[twitter]': { | |
required: false | |
}, | |
'website_config[googlePlus]': { | |
required: false | |
}, | |
'website_config[linkedIn]': { | |
required: false | |
}, | |
'website_config[file]': { | |
required: false | |
} | |
} | |
}); | |
} | |
var handleValidationLanguage = function () { | |
var form1 = $('#frm_language'); | |
form1.validate({ | |
errorElement: 'span', //default input error message container | |
errorClass: 'help-block help-block-error', // default input error message class | |
focusInvalid: false, // do not focus the last invalid input | |
ignore: "", // validate all fields including form hidden input | |
messages: { | |
'language[name]': { | |
required: 'Ce champ est obligatoire' | |
} | |
}, | |
rules: { | |
'language[name]': { | |
required: true | |
} | |
} | |
}); | |
} | |
var handleValidationCompetence = function () { | |
var form1 = $('#frm_competence'); | |
form1.validate({ | |
errorElement: 'span', //default input error message container | |
errorClass: 'help-block help-block-error', // default input error message class | |
focusInvalid: false, // do not focus the last invalid input | |
ignore: "", // validate all fields including form hidden input | |
messages: { | |
'competence[name]': { | |
required: 'Ce champ est obligatoire' | |
} | |
}, | |
rules: { | |
'competence[name]language[name]': { | |
required: true | |
} | |
} | |
}); | |
} | |
var handleValidationPostType = function () { | |
var form1 = $('#frm_postType'); | |
form1.validate({ | |
errorElement: 'span', //default input error message container | |
errorClass: 'help-block help-block-error', // default input error message class | |
focusInvalid: false, // do not focus the last invalid input | |
ignore: "", // validate all fields including form hidden input | |
messages: { | |
'post_type[name]': { | |
required: 'Ce champ est obligatoire' | |
} | |
}, | |
rules: { | |
'post_type[name]': { | |
required: true | |
} | |
} | |
}); | |
} | |
var handleValidationCandidateAccount = function () { | |
var form1 = $('#frm_candidateAccount'); | |
form1.validate({ | |
errorElement: 'span', //default input error message container | |
errorClass: 'help-block help-block-error', // default input error message class | |
focusInvalid: false, // do not focus the last invalid input | |
ignore: "", // validate all fields including form hidden input | |
messages: { | |
'job_seeker[username]': { | |
required: 'Ce champ est obligatoire' | |
}, | |
'job_seeker[email]': { | |
required: 'Ce champ est obligatoire' | |
}, | |
'job_seeker[plainPassword][first]': { | |
required: 'Ce champ est obligatoire' | |
}, | |
'job_seeker[plainPassword][second]': { | |
required: 'Ce champ est obligatoire' | |
} | |
}, | |
rules: { | |
'job_seeker[username]': { | |
required: true | |
}, | |
'job_seeker[email]': { | |
required: true | |
}, | |
'job_seeker[plainPassword][first]': { | |
required: true | |
}, | |
'job_seeker[plainPassword][second]': { | |
required: true | |
}, | |
'job_seeker[enabled]': { | |
required: false | |
} | |
} | |
}); | |
} | |
var handleValidationCandidatesLanguages = function () { | |
var form1 = $('#frm_candidatesLanguages'); | |
form1.validate({ | |
errorElement: 'span', //default input error message container | |
errorClass: 'help-block help-block-error', // default input error message class | |
focusInvalid: false, // do not focus the last invalid input | |
ignore: "", // validate all fields including form hidden input | |
messages: { | |
'candidates_languages[language]': { | |
required: 'Ce champ est obligatoire' | |
}, | |
'candidates_languages[level]': { | |
required: 'Ce champ est obligatoire' | |
} | |
}, | |
rules: { | |
'candidates_languages[language]': { | |
required: true | |
}, | |
'candidates_languages[level]': { | |
required: true | |
} | |
} | |
}); | |
} | |
var handleValidationCandidatesCompetences = function () { | |
var form1 = $('#frm_candidatesCompetences'); | |
form1.validate({ | |
errorElement: 'span', //default input error message container | |
errorClass: 'help-block help-block-error', // default input error message class | |
focusInvalid: false, // do not focus the last invalid input | |
ignore: "", // validate all fields including form hidden input | |
messages: { | |
'candidates_competences[competence]': { | |
required: 'Ce champ est obligatoire' | |
}, | |
'candidates_competences[level]': { | |
required: 'Ce champ est obligatoire' | |
} | |
}, | |
rules: { | |
'candidates_competences[competence]': { | |
required: true | |
}, | |
'candidates_competences[level]': { | |
required: true | |
} | |
} | |
}); | |
} | |
var handleValidationSector = function () { | |
var form1 = $('#frm_sector'); | |
form1.validate({ | |
errorElement: 'span', //default input error message container | |
errorClass: 'help-block help-block-error', // default input error message class | |
focusInvalid: false, // do not focus the last invalid input | |
ignore: "", // validate all fields including form hidden input | |
messages: { | |
'sector[name]': { | |
required: 'Ce champ est obligatoire' | |
} | |
}, | |
rules: { | |
'sector[name]': { | |
required: true | |
} | |
} | |
}); | |
} | |
var handleValidationProfession = function () { | |
var form1 = $('#frm_profession'); | |
form1.validate({ | |
errorElement: 'span', //default input error message container | |
errorClass: 'help-block help-block-error', // default input error message class | |
focusInvalid: false, // do not focus the last invalid input | |
ignore: "", // validate all fields including form hidden input | |
messages: { | |
'profession[name]': { | |
required: 'Ce champ est obligatoire' | |
}, | |
'profession[sector]': { | |
required: 'Ce champ est obligatoire' | |
} | |
}, | |
rules: { | |
'profession[name]': { | |
required: true | |
}, | |
'profession[sector]': { | |
required: true | |
} | |
} | |
}); | |
} | |
var handleValidationCoverLetter = function () { | |
var form1 = $('#frm_coverLetter'); | |
form1.validate({ | |
errorElement: 'span', //default input error message container | |
errorClass: 'help-block help-block-error', // default input error message class | |
focusInvalid: false, // do not focus the last invalid input | |
ignore: "", // validate all fields including form hidden input | |
messages: { | |
'cover_letter[title]': { | |
required: 'Ce champ est obligatoire' | |
}, | |
'cover_letter[content]': { | |
required: 'Ce champ est obligatoire' | |
} | |
}, | |
rules: { | |
'cover_letter[title]': { | |
required: true | |
}, | |
'cover_letter[content]': { | |
required: true | |
}, | |
'cover_letter[enabled]': { | |
required: false | |
} | |
} | |
}); | |
} | |
var handleValidationDocument = function () { | |
var form1 = $('#frm_document'); | |
form1.validate({ | |
errorElement: 'span', //default input error message container | |
errorClass: 'help-block help-block-error', // default input error message class | |
focusInvalid: false, // do not focus the last invalid input | |
ignore: "", // validate all fields including form hidden input | |
messages: { | |
'document[title]': { | |
required: 'Ce champ est obligatoire' | |
} | |
}, | |
rules: { | |
'document[candidate]': { | |
required: false | |
}, | |
'document[title]': { | |
required: true | |
}, | |
'document[media][file]': { | |
required: false | |
}, | |
'document[enabled]': { | |
required: false | |
} | |
} | |
}); | |
} | |
var handleValidationCandidate = function () { | |
//Vérifier si l'âge >= 18 | |
$.validator.addMethod("candidate_birthday", function () { | |
//récupérer date saisie | |
var datesaisi = $('#candidate_birthday').val(); | |
var jour = datesaisi.substring(0, 2); | |
var mois = datesaisi.substring(3, 5); | |
var annee = datesaisi.substring(6, 15); | |
var mydate = new Date(); | |
mydate.setFullYear(annee, mois - 1, jour - 1); | |
//date current | |
var currdate = new Date(); | |
currdate.setFullYear(currdate.getFullYear() - 18); | |
return currdate > mydate; | |
}); | |
var form1 = $('#frm_candidate'); | |
form1.validate({ | |
errorElement: 'span', //default input error message container | |
errorClass: 'help-block help-block-error', // default input error message class | |
focusInvalid: false, // do not focus the last invalid input | |
ignore: "", // validate all fields including form hidden input | |
messages: { | |
'candidate[firstName]': { | |
required: 'Ce champ est obligatoire' | |
}, | |
'candidate[lastName]': { | |
required: 'Ce champ est obligatoire' | |
}, | |
'candidate[title]': { | |
required: 'Ce champ est obligatoire' | |
}, | |
'candidate[birthday]': { | |
required: 'Ce champ est obligatoire', | |
candidate_birthday: 'Votre âge doit être >= 18 ans.' | |
}, | |
'candidate[gender]': { | |
required: 'Ce champ est obligatoire' | |
}, | |
'candidate[situationPro]': { | |
required: 'Ce champ est obligatoire' | |
}, | |
'candidate[tel]': { | |
required: 'Ce champ est obligatoire' | |
}, | |
'candidate[address]': { | |
required: 'Ce champ est obligatoire' | |
}, | |
'candidate[maritalStatus]': { | |
required: 'Ce champ est obligatoire' | |
}, | |
'candidate[studyLevel]': { | |
required: 'Ce champ est obligatoire' | |
}, | |
'candidate[postTypes][]': { | |
required: 'Ce champ est obligatoire' | |
}, | |
'candidate[sector]': { | |
required: 'Ce champ est obligatoire' | |
}, | |
'candidate[address][street]': { | |
required: 'Ce champ est obligatoire' | |
}, | |
'candidate[address][country]': { | |
required: 'Ce champ est obligatoire' | |
}, | |
'candidate[address][state]': { | |
required: 'Ce champ est obligatoire' | |
}, | |
'candidate[kids]': { | |
required: 'Ce champ est obligatoire' | |
}, | |
'candidate[prior]': { | |
required: 'Ce champ est obligatoire' | |
} | |
}, | |
rules: { | |
'candidate[firstName]': { | |
required: true | |
}, | |
'candidate[lastName]': { | |
required: true | |
}, | |
'candidate[title]': { | |
required: true | |
}, | |
'candidate[interests]': { | |
required: false | |
}, | |
'candidate[birthday]': { | |
required: true, | |
candidate_birthday: true | |
}, | |
'candidate[contactDetails]': { | |
required: false | |
}, | |
'candidate[salaireMin]': { | |
required: false | |
}, | |
'candidate[file]': { | |
required: false | |
}, | |
'candidate[gender]': { | |
required: true | |
}, | |
'candidate[disponibility]': { | |
required: false | |
}, | |
'candidate[situationPro]': { | |
required: true | |
}, | |
'candidate[salaireActuel]': { | |
required: false | |
}, | |
'candidate[maritalStatus]': { | |
required: true | |
}, | |
'candidate[tel]': { | |
required: true | |
}, | |
'candidate[address][street]': { | |
required: true | |
}, | |
'candidate[studyLevel]': { | |
required: true | |
}, | |
'candidate[postTypes][]': { | |
required: true | |
}, | |
'candidate[occupations]': { | |
required: false | |
}, | |
'candidate[sector]': { | |
required: true | |
}, | |
'candidate[address][country]': { | |
required: true | |
}, | |
'candidate[address][state]': { | |
required: true | |
}, | |
'candidate[kids]': { | |
required: true | |
}, | |
'candidate[prior]': { | |
required: true | |
} | |
} | |
}); | |
} | |
var handleValidationTestimonial = function () { | |
var form1 = $('#frm_testimonial'); | |
form1.validate({ | |
errorElement: 'span', //default input error message container | |
errorClass: 'help-block help-block-error', // default input error message class | |
focusInvalid: false, // do not focus the last invalid input | |
ignore: "", // validate all fields including form hidden input | |
messages: { | |
'testimonial[firstName]': { | |
required: 'Ce champ est obligatoire' | |
}, | |
'testimonial[lastName]': { | |
required: 'Ce champ est obligatoire' | |
}, | |
'testimonial[description]': { | |
required: 'Ce champ est obligatoire' | |
} | |
}, | |
rules: { | |
'testimonial[firstName]': { | |
required: true | |
}, | |
'testimonial[lastName]': { | |
required: true | |
}, | |
'testimonial[description]': { | |
required: true | |
} | |
} | |
}); | |
} | |
return { | |
//main function to initiate the module | |
init: function () { | |
handleValidation1(); | |
} | |
}; | |
}(); | |
jQuery(document).ready(function () { | |
FormValidation.init(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment