abracadabraPDF › Forums › PDF – Général › Validation champs obligatoires – RÉSOLU › Répondre à : Validation champs obligatoires – RÉSOLU
Je me permets de rebondir sur ce sujet déjà créer.
Concernant le script que l’on peut trouver sur le lien :
function validateFields() {
//a counter for the number of empty fields
var flg = 0
// count all the form fields
var n = this.numFields
//create an array to contain the names of required fields
//if they are determined to be empty
var fArr = new Array();
//loop through all fields and check for those that are required
// all fields that have a ‘*’ in their tool tip are required
for(var i = 0;i0){
app.alert(‘There are ‘+flg+’ fields that require a valuenn’+ fArr,3)
}
else{
this.print();
}
}
validateFields();
Cela check TOUS les champs en supposant qu’ils sont tous obligatoire.
Il n’y a donc pas de trie entre les champs obligatoire et les champs NON obligatoire.
Existe-t-il un moyen semblable de controler uniquement les champs obligatoires ?
Sans avoir à tous les lister 1 à 1 ? Car ca peut vite devenir fastidieux, et donc source d’erreur 
