Hi. I have my text field that I formatted so that we can fill in the dates of birth. I then put javascript codes to avoid the errors of seizures and that the men of more than 40 years are registered. At first it worked well but now, nothing. On the other hand locally it works. Can you help me please?
[file=12306]Capture1.PNG[/file]



javascript57
[file=12306]Capture1.PNG[/file]
javascript57
jQuery.fn.form.settings.rules.verifnaissance = function(value, param) {javascript59
var dateNow = new Date();
var currentYear = dateNow.getFullYear();
strSaisie = value.replace(/-/g,"");
var yearSaisie = Number(strSaisie.substr(4,4));
if(document.getElementById('sex0').checked){
var valeur = document.getElementById('sex0').value;
} else{
if(document.getElementById('sex1').checked){
var valeur = document.getElementById('sex1').value;
}
}
if(valeur != null && yearSaisie ==0) {
return true;
}
if ((currentYear - yearSaisie)<18 || ((valeur == 'M') && (currentYear - yearSaisie) > 40)) {
return false;
}else{
return true;
}
};
jQuery.fn.form.settings.rules.verifNaN = function(value, param) {
str = value.replace(/-/g,"");
var year = str.substr(7,1);
if( year == 'y') {
return false;
}else{
return true;
}
};