abracadabraPDF › Forums › PDF – Général › Auto-tab d’un champ à un autre quand le nombre de carac maxi est atteint › Répondre à : Auto-tab d’un champ à un autre quand le nombre de carac maxi est atteint
Bonjour
:soleil:
Merci bebarth pour ton temps
Je modifierai bien le titre du post par « Passage auto d’un champ à un autre, qd le nombre de carac max atteint ».
Promis je ferai un effort dans l’avenir.
Je partage la solution que j’ai trouvée, en fait deux solutions :
– La première si les champs sont en numérique
Création d’une fonction : (à insérer en script de document)
AutoTab
{
// Call the built-in routine to allow numbers only.
AFNumber_Keystroke(0, 0, 0, 0, « », true);
// If we’ve filled in the field completely, jump to the next one.
if (event.rc && AFMergeChange(event).length == event.target.charLimit)
doc.getField(cNext).setFocus();
}
Puis sur le champ concerné en script de Format de touche personnalisé :
Cela fonctionne à merveille.
– La seconde dans le cas de champs en alphanumérique :
// Move to next field if Enter key is pressed
// or the user has clicked outside of the field
// or if the number of character is the character limit
if (event.willCommit || AFMergeChange(event).length === event.target.charLimit) {
getField(cNext).setFocus();
}
}
Puis sur le champs concerné en script de Format de touche personnalisé :
Source Adaptation de ce post https://forums.adobe.com/thread/1422992
Belle journée à tous.
Le PDF modifié est en PJ