 //Contrôle de saisie spécifique :
//Pour en implémenter : faire commencer le nom par ph
//il suffit ensuite que le nom du champ qui y fera appel soit nommé avf_xxxx ou aaf_xxxx
//où xxxx reprend le nom de la fonction sans être précédé de ph
//Répéter un mot de passe (mot de passe obligatoire)
var second;
var premier;
function phmdpbis(a,b){
second = document.forms[a].elements[b].value;
premier = document.forms[a].elements['avf_mdp'].value;
if (second == '' || second != premier){
monal = 'k' + b.substring(3);
montrer(monal);
document.forms[a].elements[b].focus();
comdeb = 'non';
monal = eval(b.substring(4));
nappe[dezero] = monal + '\n\n';
dezero++;
}
}
//Longeur minimale du mot de passe et sa répétition (mot de passe obligatoire)
function phmdp(a,b){
premier = document.forms[a].elements[b].value;
if (premier.length < 5){
monal = 'k' + b.substring(3);
montrer(monal);
document.forms[a].elements[b].focus();
comdeb = 'non';
monal = eval(b.substring(4));
nappe[dezero] = monal + '\n\n';
dezero++;
}
}
//Répéter un mot de passe (mot de passe facultatif)
var second;
var premier;
function phmotdpbis(a,b){
second = document.forms[a].elements[b].value;
premier = document.forms[a].elements['aaf_motdp'].value;
if (second != premier){
monal = 'k' + b.substring(3);
montrer(monal);
document.forms[a].elements[b].focus();
comdeb = 'non';
monal = eval(b.substring(4));
nappe[dezero] = monal + '\n\n';
dezero++;
}
}
//Longeur minimale du mot de passe et sa répétition (mot de passe facultatif)
function phmotdp(a,b){
second = document.forms[a].elements['aaf_motdpbis'].value;
if (second == ''){
phmotdpbis(a,'aaf_motdpbis')
}
premier = document.forms[a].elements[b].value;
if (premier.length < 5){
monal = 'k' + b.substring(3);
montrer(monal);
document.forms[a].elements[b].focus();
comdeb = 'non';
monal = eval(b.substring(4));
nappe[dezero] = monal + '\n\n';
dezero++;
}
}
//Plusieurs adresses électroniques
var tranche;
var tranches = new Array();
function phmeldest(a,b){
tranche = document.forms[a].elements[b].value;
var ainkr = 0;
if(tranche == null || tranche.length == 0){
ainkr++;
}
else{
if (tranche.indexOf(';') > -1){
tranches = tranche.split(';');
}
else {
tranches[0] = tranche;
}
for (w=0;w<tranches.length;w++){
fragment = tranches[w];
//à refaire
while (fragment.charAt(0) == " " && fragment.length > 0){
fragment = fragment.substring(1, fragment.length);
}
while (fragment.charAt(fragment.length - 1) == " " && fragment.length > 0){
fragment = fragment.substring(0, fragment.length - 1);
}
emailRegExp = /^((\".+\")|[a-zA-Z0-9-!#$%&\'*+\/=?^_`{|}~]+)(\.((\".+\")|[a-zA-Z0-9-!#$%&\'*+\/=?^_`{|}~]+))*@(([a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+)|(\[(((2[0-5]{2})|([0-1]{0,1}[0-9]{1,2}))((\.((2[0-5]{2})|([0-1]{0,1}[0-9]{1,2}))){3}))\]))$/;
if (!fragment.match(emailRegExp)){
ainkr++;
break;
}
if (ainkr > 0){
break;
}
}
}
if (ainkr > 0){
monal = 'k' + b.substring(3);
montrer(monal);
document.forms[a].elements[b].focus();
comdeb = 'non';
monal = eval(b.substring(4));
nappe[dezero] = monal + '\n\n';
dezero++;
}
}