Forum Moderators: open

Message Too Old, No Replies

substring function call

         

mikemcs

3:17 pm on Mar 18, 2004 (gmt 0)

10+ Year Member



I have anywhere from 4 - 10 text edits on my form. Each text edits name start with lot then I add on the back of the name a value according to a field in a database. I want to call a function called validlot and send this textbox name to it. How can I rewrite this statement below to grab any textbox that starts with the letters lot?

if (!validlot(theForm.lot*****,"Qty",true))
return false;

dcrombie

12:02 pm on Mar 19, 2004 (gmt 0)



This should help you get started - I think the syntax is right. All you need then is a regex or string.indexOf to work out which elements need validating.

for (var x in theForm.elements) { 
alert (theForm.elements[x].name);
}