Hi Thom,
I have a custom format script in a form field that I am using to change a number that is entered into a field. The problem I am having is that when the form is submitted or exported to an fdf file, it exports the value that was originally entered instead of what the field is being formatted to. How do I force the data to change to the format that I want. The format script that I am using is included below. You've helped me with another question about this script before. I am a beginner with javascript and would appreciate your help. Thanks!
The script I am using is shown below:
// RegExp input (999-999-9999) for format
var reHyphens = /^(\d{3})[-](\d{3})[-](\d{4})$/
var reNoHyphens = /^(\d{3})(\d{3})(\d{4})$/
var rePeriods = /^(\d{3})[.](\d{3})[.](\d{4})$/
var reSpaces = /^(\d{3})[ ](\d{3})[ ](\d{4})$/
if(reHyphens.test(event.value))
event.value = RegExp.$1 + "." + RegExp.$2 + "." + RegExp.$3;
else if(reNoHyphens.test(event.value))
event.value = RegExp.$1 + "." + RegExp.$2 + "." + RegExp.$3;
else if(rePeriods.test(event.value))
event.value = RegExp.$1 + "." + RegExp.$2 + "." + RegExp.$3;
else if(reSpaces.test(event.value))
event.value = RegExp.$1 + "." + RegExp.$2 + "." + RegExp.$3;
To make the formated value the export value you have to move this script to the Commited Keystroke event like this.
if(event.willCommit)
{
.... All your existing code ...
}
Thom Parker
WindJack Solutions
[url=http://www.windjack.com]www.windjack.com[/url]
The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/]http://www.adobe.com/devnet/acrobat/[/url]
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script