Expand my Community achievements bar.

SOLVED

Check with button if a field contains a specific character else message box if not

Avatar

Level 2

Hi Guys,

Can I get a little help please?

I have a button and I would like to add some javascript in it to check some fields.

If the field contains a "-" character then nothing

else appear a message.

if ((name_7.rawValue.match(/-/)==0 ) {

 

          }

else {app.alert("Fill in with -!");}

Thanks,

encleadus

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

The match function will return a null if there is no match, so try;

if (name_7.rawValue.match(/-/)==null)

{

    app.alert("Fill in with -!");

}

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Hi,

The match function will return a null if there is no match, so try;

if (name_7.rawValue.match(/-/)==null)

{

    app.alert("Fill in with -!");

}