Answered
Need a script for limiting a user to be able to enter only 0 or 3 in a numeric field
Need a script for limiting a user to be able to enter only 0 or 3 in a numeric field
if(!/^[03]?$/.test(xfa.event.newText))xfa.event.change = "";
You can use the change event to restrict whats entered in the field. The new data entered into the field is in the "xfa.event.change" property. If you set this property to an empty string then there is no data entry. The "xfa.event.preText" property contains the data in the field before the user typed anything and "xfa.event.newText" property contains the data that will be in the field afterward. Using these values you can decide how to set "xfa.event.change".
Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]
The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]
Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script