Skip to main content
This topic is closed to new replies. Start a new post to keep the conversation going.
try67
try67Correct answer
Community Expert
Jul 11, 2017 1:51 PM UTC

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

4 replies

try67
Community Expert
Community Expert
Jul 11, 2017 1:14 PM UTC

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;

}

Translate
Participant
Jul 11, 2017 1:29 PM UTC

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

}

Translate
try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
Jul 11, 2017 1:51 PM UTC

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

Translate