Forum Moderators: open

Message Too Old, No Replies

clearing via looping

         

natty

8:33 am on Mar 27, 2003 (gmt 0)

10+ Year Member



hi again all,

im wanting to clear a whole load of fields in a form, all these fields have either 'ret' ¦¦ 'Ret' on their name.
so i tried this

for (i=0;i<document.forms[0].elements.length;i++){
if (document.forms[0].elements[i].name.indexOf('ret')!= -1 ¦¦ document.forms[0].elements[i].name.indexOf('Ret')!= -1){
fieldtoclear = document.forms[0].elements[i];
clearselect (fieldtoclear);
}
}

clearselect is a little function to do just that.
the only problem is, (this is just for NN btw) it seems to clear the field that fires off the script, even tho it certainly does NOT have ret in its name at all.
i even tried a
if(fieldtoclear.name!= 'selJourney'){
//then do the clearing..
}
to avoid this field (selJourney the one i want to leave alone). sadly it still does it.. am i missing something obvious as usual..
many thanks in advance..

nat

natty

8:41 am on Mar 27, 2003 (gmt 0)

10+ Year Member



omw, i found out what the problem was. how netscrape annoys me.
there were some hidden fields with 'ret' in the title above the field 'selJourney' in the form, i moved them to the bottom of the form and all is well.
what a load of old pants netscape 4 is....
but you all knew that :)