Forum Moderators: open

Message Too Old, No Replies

Javascript - Checking field value against an array

         

chris_f

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

WebmasterWorld Senior Member 10+ Year Member



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?

daveVk

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

WebmasterWorld Senior Member 10+ Year Member



This what you mean?

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

chris_f

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

WebmasterWorld Senior Member 10+ Year Member



I'll give it a go and let you know. Thanks.

chris_f

1:27 pm on Jul 20, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



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

Thanks