Expand my Community achievements bar.

SOLVED

drop down box validation

Avatar

Level 4

Hi

I am trying to validate a drop down box using scripting so that if a user enters text instead of a number there is an error message.  I can validate it so that it checks for the length (using.length), but how do I differentiate between a number and text. I know it can be done as it works in the validate function of the object menu.

Thanks

Darren

1 Accepted Solution

Avatar

Correct answer by
Level 6

Hi,

You can differentiate between a number and text by this script:

if (isNaN(Number('asdf'))){

app.alert("Not number");

}

BR,

Paul Butenko

View solution in original post

14 Replies

Avatar

Correct answer by
Level 6

Hi,

You can differentiate between a number and text by this script:

if (isNaN(Number('asdf'))){

app.alert("Not number");

}

BR,

Paul Butenko

Avatar

Level 4

Hi

I cannot seem to get this to work  Can you giveme this in the context of an object that I am putting it into on the exit event, i.e Subform1.Object1........

Thanks

Darren

Avatar

Level 6

Hi,

I made some example form for you. Type something into Drop down list, on exit event there is some script which will inform you number on not nember values you typed in.

BR,

Paul Butenko

Avatar

Level 4

Hi Paul

The form you attached is saying that it is queued and has been since your post.  Can you send it to me at djl64@st-andrews.ac.uk.

Thanks

Darren

Avatar

Level 4

Hi Paul

Can you re-send this to djlightfoot@vodafone.net.  My work email is not accepting attachments for some reason.  Very sorry for all the hassle with this.  Your original form is still queued.  Is this correct?

Thanks

Darren

Avatar

Level 6

Hi,

Form was sent again. I don't know why it is still queued. I'm also think this is wrong )

Avatar

Level 4

Did you send this to the new email account djlightfoot@vodafone.net?

Thanks

Darren

Avatar

Level 4

Al received and many thanks for your patience Paul.

Darren

Avatar

Level 4

Hi Paul

Sorry to trouble you again but when I try to put this code into my text box field on my form it is not working, something strange seems to be going on.  I have copied a text field with the code from a blank document into my form and this is fine but when I try to put the code into my actual text field it does not work, and I have thought and tried lots of differnet things but cant work it out.  I attach an example for you and if you get a chance to let me know what I am doing wrong that would be great.  All I am basically trying to do is validate for a telephone number without using the LiveCycle's validation options.

Thanking you in advance.

Darren

Avatar

Level 6

Hi,

I also can understand behaviour of this form. I tried to remove all scripts from form except validation but it didn't help.

Maybe we are using different versions of Designer? I'm using 8.2.1.326.

One bad sugestion is to recreate from from beggining, maybe it can help.

BR

Avatar

Level 4

Hi Paul

I have played around with it and it definitely has something to do with the

fact that the text field is now part of a subform. If you put the

textfield outside of the subform so it is linked to the page it works. I

have tried referencing the textfield in the long fashion when it is part of

the subform but it does not work so I am tearing my hair out.

Is this any help or is there a different way that I can validate a telephone

number? I didn’t think it would be this hard!! I am on 8.2.1.4......

Thanks

Darren

Avatar

Level 6

Hi,

You can use Numeric Field or Text Fielf with pattern like this num{999999999}

BR,

Paul Butenko