Skip to main content
Participant
Jan 12, 2017 1:56 PM UTC
Answered

Remove accents from entire PDF form on submit

Hello!

Any ideeas how to remove all accents from all PDF form inputs on submit?

I am interested in doing this on client side, before the submitted data reaches the server.

I.e. i type in a input field from the PDF form the string "șțâȘȚÂ"  and after submit button is pressed the output needs to be "staSTA". I did some research on some topics with javascript but it didnt work out for me.

Thanks!

This topic is closed to new replies. Start a new post to keep the conversation going.
try67
try67Correct answer
Community Expert
Jan 13, 2017 2:33 PM UTC

The doc-level script would be something like this:

function replaceAccents(s) {

    s = s.replace(/ș/g , "s");

    return s;

}

And then you call it like this:

this.getField("Text1").value = replaceAccents(this.getField("Text1").value);

9 replies

JR Boulay
Community Expert
Community Expert
Jan 13, 2017 4:59 PM UTC

Hi.

Can't the JavaScript-GREP use Posix regex ?

In a regex, searching for [[=a=]] mean searching any form of the "a", with or without accent, then you can replace by a "a".

This works for any letter.

Translate
Acrobate du PDF, InDesigner et Photoshopographe
try67
Community Expert
Community Expert
Jan 13, 2017 5:40 PM UTC

No, it can't, but you can match multiple character by putting them in

square brackets.

Translate
try67
Community Expert
Community Expert
Jan 12, 2017 3:26 PM UTC

Yes, this would require using a custom-made script. You would need to write a function that replaces the accented characters with non-accented ones and then call it for each (text) field in your file, before submitting it.

Translate
CilonSAuthor
Participant
Jan 13, 2017 7:31 AM UTC

Problem is i don't know how to work with adobe pro so well...i only found out how to add a custon keystroke script in the text field properties of the adobe form. Did something like this:

if (!event.willCommit) {

    event.change = event.change.replace(/ș/g , "s");;

}

But this replaces my char as i type, and i want it to be changed when i press the submit button.

Translate
try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
Jan 13, 2017 2:33 PM UTC

The doc-level script would be something like this:

function replaceAccents(s) {

    s = s.replace(/ș/g , "s");

    return s;

}

And then you call it like this:

this.getField("Text1").value = replaceAccents(this.getField("Text1").value);

Translate