Copy link to clipboard
Copied
I need a adobe acrobat javascript for text not be start with hyphen.
So this is a custom Keystroke script? If so, try this:
var RE_Alpha = /^[A-Za-z_ -]*$/;
var RE_Hyphen = /^-/;
event.rc = RE_Alpha.test(event.change) && !RE_Hyphen.test(AFMergeChange(event));
Copy link to clipboard
Copied
As a validation script? You can use this:
if (/^-/.test(event.value)) {
app.alert("The value must not begin with a hyphen.");
event.rc = false;
}
Copy link to clipboard
Copied
Thanks for your reply,this is my code below.but this working with start on hyphen. but i don't want to start with hyphen. please help me sir.
if(event.fieldFull == true){
alertDialog(errorMsgs.msg007);
}
if (event.willCommit == false) {
var RE_Alpha = /^[A-Za-z_ -]*$/;
event.rc = RE_Alpha.test(event.change);
}
Copy link to clipboard
Copied
So this is a custom Keystroke script? If so, try this:
var RE_Alpha = /^[A-Za-z_ -]*$/;
var RE_Hyphen = /^-/;
event.rc = RE_Alpha.test(event.change) && !RE_Hyphen.test(AFMergeChange(event));
Copy link to clipboard
Copied
thanks a lot sir.this is working