Question : Possible to remove characters from form fields in Acrobat that were filled by import, using JS?

Thanks for taking the time to look at this.

I have to import a lot of fdf files into a master acrobat form.  The original fdf's allowed characters in the form fields that we do not allow now.
So I have a form field called TaxID, it has to contain just 9 numbers:  "123456789"
Unfortunately, many of my fdf's record the taxid with the customary dash after the second digit: "12-3456789"
Regardless of arbitrary mask or validation settings (that work with typed input) the imported fdf always keeps the dash.
Is there any way to remove that dash with a javascript, either with a button press or automatically?

Answer : Possible to remove characters from form fields in Acrobat that were filled by import, using JS?

I am really sorry about that, but my code contains a typo... Here is the correct version. That's why one should never just make a change without actually running the JavaScript.

The problem is in the first line, the "" needs to be added to the value that you get from the event.target.
1:
2:
3:
var str = event.target.value + ""; // this will force the value to be a string
str = str.replace(/[\. ,\- ;:]/g, "");
event.value = str;
Open in New Window Select All
Random Solutions  
 
programming4us programming4us