abracadabraPDF › Forums › PDF – Général › Code JavaScript pour vérification de formulaire › Répondre à : Code JavaScript pour vérification de formulaire

mais comment tu mets les champs qui sont vide en surbrillance ?
Il faut modifier le script ci-dessus ainsi :
var ncompteur=0;
for (var k=0; k
var oChamp = this.getField(strName);
if (oChamp.required == true) {
if ((oChamp.type == « text ») && (oChamp.value == « »)) {
ncompteur = ncompteur+1;
oChamp.strokeColor = color.red;
}
else if ((oChamp.type == « checkbox ») && (oChamp.value == « Off »)) {
ncompteur = ncompteur+1;
oChamp.strokeColor = color.red;
}
}
}
if (ncompteur==0) {
this.getField(« Signature1 »).display=display.visible;
}
else {
this.getField(« Signature1 »).display=display.hidden;
}
Ce qui nous donne ceci une fois exprimé en formulation simplifiée bebarthienne : :Smiley03:
if (oChamp.required == true && (((oChamp.type == « text ») && (oChamp.value == « »)) || ((oChamp.type == « checkbox ») && (oChamp.value == « Off »)))) {
ncompteur++;
oChamp.strokeColor = color.red;
}
if (ncompteur==0) {
this.getField(« Signature1 »).display=display.visible;
}
else {
this.getField(« Signature1 »).display=display.hidden;
}