Copy link to clipboard
Copied
I have two pdf forms, one in English language, the other is in Arabic, how to restrict the fields of each form to accept only English text for the fields of the English form, and only Arabic text for the fields of the Arabic form? thank you
You can use the following code as the custom validation script of your field to reject any values that contain English letters:
if (/[a-z]/gi.test(event.value)) {
app.alert("Error! This field may not contain any English letters.");
event.rc = false;
}
And this one to reject any values that contain Arabic letters:
if (/[\u0600-\u06FF]/g.test(event.value)) {
app.alert("Error! This field may not contain any Arabic letters.");
event.rc = false;
}
Copy link to clipboard
Copied
This would be interesting Mazen! I suppose once you create a text field, then any one filling the form can switch to the language of choice with no restriction. I'd also like to get the script if any one helps out.
Copy link to clipboard
Copied
You can use the following code as the custom validation script of your field to reject any values that contain English letters:
if (/[a-z]/gi.test(event.value)) {
app.alert("Error! This field may not contain any English letters.");
event.rc = false;
}
And this one to reject any values that contain Arabic letters:
if (/[\u0600-\u06FF]/g.test(event.value)) {
app.alert("Error! This field may not contain any Arabic letters.");
event.rc = false;
}
Copy link to clipboard
Copied
The script works well, it will not accept English text entry for the first code, and no Arabic in the second. An error will pop up indicating that a wrong language is being used. I changed displayed message to… Arabic Only بالعربية فقط
Thanks try67
Copy link to clipboard
Copied
it worked nicely, thank you so much try67
Copy link to clipboard
Copied
The problem is, IMHO, that there are valid accented letters in English, and (assuming) valid latin letters in Arabic text. That would have to be taken care of with additional logic. An additional question is how to treat numbers, particularly if you want to have some calculations involved.
Copy link to clipboard
Copied
My script doesn't reject accented characters in the English field, only those characters that fall within the "block" of Arabic characters in Unicode.
Copy link to clipboard
Copied
Nor does it reject numbers, in either one of the codes.
Copy link to clipboard
Copied
Does it reject accented latin characters in the Arabic field?
Copy link to clipboard
Copied
Yes.