Donnez vie à vos documents numériques !
 

Répondre à : Condition sur premier caractère

abracadabraPDF Forums PDF – Général Condition sur premier caractère Répondre à : Condition sur premier caractère

#73779
michel c.
Participant

J’ai réussi en modifiant la fin des scripts se trouvant affectés aux champs num et den :

if (this.getField("numOk").value <0) {var Numerat="-"+decomposition(this.getField("numOk").value).toString().replace(/[,]/g," x ");} if (this.getField("numOk").value >0) {var Numerat=decomposition(this.getField("numOk").value).toString().replace(/[,]/g," x ");}

if (Numerat.length == 1) {this.getField("num").value = "1 × "+Numerat;}
if (Numerat.length != 1) {this.getField("num").value = Numerat;}

et

if (this.getField("denOk").value <0) {var Denom="-"+decomposition(this.getField("denOk").value).toString().replace(/[,]/g," x ");} if (this.getField("denOk").value >0) {var Denom=decomposition(this.getField("denOk").value).toString().replace(/[,]/g," x ");}

if (Denom.length == 1) {this.getField("den").value = "1 × "+Denom;}
if (Denom.length != 1) {this.getField("den").value = Denom;}

Ainsi s’il n’y a qu’un seul caractère la valeur du champ sera affectée du préfixe “1 × ”

Et ça marche

 

  • Cette réponse a été modifiée le il y a 1 année et 1 mois par michel c..