Skip to main content
This topic has been closed for replies.
Correct answer try67

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));

1 reply

try67
Community Expert
Community Expert
July 11, 2017

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;

}

Participant
July 11, 2017

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);

}

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
July 11, 2017

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));