Hi there
I am now working on an extended version of the issue describes in this thread: http://forums.adobe.com/message/3147856#3147856
The new field should hold digits in the format 9999-99999-99999-99, and I would like the hyphens to appear automatically when typing. I tried to modify the script I used before, but I can't get it to work properly. Can someone tell me, what I'm doing wrong?
My modified script looks this way:
if (xfa.event.change.match(/[0-9\-]/) == null)
xfa.event.change = "";
if (xfa.event.change == "-" && xfa.event.selEnd != 4)
xfa.event.change = "";
if (xfa.event.change.match(/[0-9]/) != null &&
xfa.event.newText.length == 5 &&
xfa.event.selEnd == 4)
if (xfa.event.change == "-" && xfa.event.selEnd != 10)
xfa.event.change = "";
if (xfa.event.change.match(/[0-9]/) != null &&
xfa.event.newText.length == 11 &&
xfa.event.selEnd == 10)
if (xfa.event.change == "-" && xfa.event.selEnd != 16)
xfa.event.change = "";
if (xfa.event.change.match(/[0-9]/) != null &&
xfa.event.newText.length == 17 &&
xfa.event.selEnd == 16)
{
xfa.event.change = "-" + xfa.event.change; }
var vMax = 16; if (xfa.event.newText.indexOf("-") != -3)
vMax = 19;
But it only makes the hyphen at 17th character appear automatically.
I hope to hear from you.
Kirstine