Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help with reset() on dynamic form

Status
Not open for further replies.

ixnay5

MIS
Jan 10, 2002
68
US
hi -

i'm goin' mad i tell ya! mad!

i have some "master" radio buttons that control the display of other "slave" radio buttons dynamically.

if i want to reset the form using the standard reset button, all the radio buttons clear out normally, but the slave buttons (displayed using div.style.visibility='hidden or visible') will not clear out. hmmmm...

so i try a custom reset function. i can clear the display of the slave divs, but i can't figure out how to clear out the master radio buttons. when i view (alert()) their values from within the function, they're always undefined. however, if i submit them, their actual values always reach the action page. huh? but true.

here's my custom reset button code:

<input type="button" name="reset" value="Reset" onclick="myreset();">

here's the custom reset function:

function myreset(){

//document.mainform.reset();

mainform.red.checked='false';
mainform.inter.checked='false';

DS3Div.style.visibility='hidden';
OC3Div.style.visibility='hidden';
STMDiv.style.visibility='hidden';
VocSlaveDIV.style.visibility='hidden';

}

document.mainform.reset(); isn't working...

i've tried referring to mainform.red and mainform.inter as document.mainform.red and document.mainform.inter, but it makes no difference...

lost...
 
You want to make sure that you set your radio button's checked value to the boolean false instead of a string representation of 'false'. I'd suggest changing these 2 lines and see if that fixes it:
Code:
mainform.red.checked=false;
mainform.inter.checked=false;

-kaht

banghead.gif
 
location.href="theform.htm"; is clearing everything out.

thx kaht.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top