Milonic provide full featured pull down web menus for some of the worlds largest companies
click here to see what it can do for you

Download Milonic DHTML Menu
Buy Milonic DHTML Menu

Back To Start Of Archive
Taken From The Forum: Anything Goes
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:12

a question for the JavaScript gurus...


Poster: wkilc
Dated: Tuesday January 20 2009 - 23:31:25 GMT

Hi all,

Forgive me for asking this here... but I now a lot of knowledgeable people frequent the Milonic boards.

I might be reaching, but this does have something to do with the Milonic menu, as the form in question uses the menu to populate some very long "virtual" pull-down menus. (Andy assisted me with this a few years back.)

Anyway, I am also using a JS form validation script on this form...

This line will catch and give an alert if ANY of the characters submitted in "r_First" text field contains a comma:

Code:
if ( formobj.elements['r_First'].value.indexOf( "," ) != -1 )


How would I manipulate that line so that it would complain if there was NOT a comma included SOMEWHERE in the text field response?
(That is... "," is not the whole response... but it needs to exist somewhere in the submission.)

Thanks.

~Wayne

Re: a question for the JavaScript gurus...


Poster: Andy
Dated: Wednesday January 21 2009 - 11:19:26 GMT

The value being returned is the position of the comma within the string.

Therefore if you get a minus one value the string has not been found, the following will fire if the comma is not found.

Code:
if ( formobj.elements['r_First'].value.indexOf( "," ) == -1 )

Re: a question for the JavaScript gurus...


Poster: wkilc
Dated: Wednesday January 21 2009 - 22:56:21 GMT

Thank you Andy!
:D
~Wayne