Welcome to WebmasterWorld Guest from 54.205.106.138

Forum Moderators: open

Message Too Old, No Replies

Javascript - Checking field value against an array

     
11:10 am on Jul 20, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 5, 2002
posts:1510
votes: 0


Hi All,

I have an asp webform that other users can fill in. For one field in that form (call it 'z'). I have an array (call it 'y') which holds all the values 'z' cannot be and I have a function (call it 'f') which needs to be launched if the value of 'z' appears in 'y'.

However, I am missing the bit that actually checks 'z' again the values in 'y' and launches 'f' if needed. I've done countless Google searches and come up with nothing.

Can anyone help?

11:57 am on July 20, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Nov 3, 2005
posts:1585
votes: 0


This what you mean?

for ( var i=0; i<y.length; i++ } {
if ( y[i]===myForm.z.value ) f();
}

12:26 pm on July 20, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 5, 2002
posts:1510
votes: 0


I'll give it a go and let you know. Thanks.
1:27 pm on July 20, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 5, 2002
posts:1510
votes: 0


It's working. I'm now tweaking :)

Thanks