radio button/text box problem

liunx

Guest
This is for a form I'm creating.<br />
<br />
I'm trying to get all three text boxes {month, day and year} to turn off when the "immediately" radio button is clicked and all three to turn on when the "specified date" radio button is clicked. It works fine if I only include the "month" text box but when I add the two others it fails. I tried renaming each text box "DD1","DD2","DD3" and accounting for that in the "onclick" commands to no avail. Here's how I have it written out:<br />
<br />
<br />
<INPUT TYPE="radio" NAME="DELIVERY TIME" VALUE="IMMEDIATELY" onclick="this.form.elements['DELIVERY DATE'].disabled=true; this.form.elements['IMMEDIATELY'].value=''; return true;"> <br />
<FONT COLOR="#FFFF00" SIZE="3" ID="put"><I><B>IMMEDIATELY</B></I></FONT> <br />
<br />
<INPUT TYPE="radio" NAME="DELIVERY TIME" VALUE="SPECIFIED DATE" onclick="this.form.elements['DELIVERY DATE'].disabled=false; this.form.elements['SPECIFIED DATE'].value=''; return false;"><FONT COLOR="#FFFF00" SIZE="3" ID="put"><I><B>SPECIFIED DATE</B></I></FONT> <br />
<br />
<FONT COLOR="#FFFF00" SIZE="3" ID="put"><I><B>DATE:</B></I></FONT><FONT COLOR="#FFFF00" SIZE="3" ID="put"><I><B>Month:</B></I></FONT> <br />
<br />
<INPUT TYPE="TEXT" NAME="DELIVERY DATE" VALUE="MONTH" SIZE="2"> <br />
<br />
<FONT COLOR="#FFFF00" SIZE="3" ID="put"><I><B>Day:</B></I></FONT> <br />
<br />
<INPUT TYPE="TEXT" NAME="DELIVERY DATE" VALUE="Day" SIZE="2"> <br />
<br />
<FONT COLOR="#FFFF00" SIZE="3" ID="put"><I><B>Year:</B></I></FONT><INPUT TYPE="TEXT" NAME="DELIVERY DATE" VALUE="Year" SIZE="4"> <br />
<br />
Can I use three seperate input text boxes to get this to work or do I have to use one text box for the month, day, and year?<!--content-->Nevermind. I found the answer on another board. However, I have another question concerning viewing my website in Netscape 7.0 and IE 6.0 which I'll post in another thread.<!--content-->Perhaps you could post the answer here, for anyone else who may meet this problem in the future?<!--content-->Originally posted by giz <br />
Perhaps you could post the answer here, for anyone else who may meet this problem in the future? <br />
<br />
Sure. If you already know how to get a single text box to turn on and off with two radio buttons, you just add this code, in succession to the two input radio tags:<br />
<br />
this.form.elements['DELIVERY DATE'][0].disabled=true; <br />
this.form.elements['DELIVERY DATE'][1].disabled=true; <br />
this.form.elements['DELIVERY DATE'][2].disabled=true; <br />
<br />
In my case, I wanted a seperate box for "month, "day", and "year" hence the "DELIVERY DATE" identifier.<br />
<br />
The only difference between the code for two radio buttons working in conjucntion with ONE text box and two radio buttons working in conjunction with THREE is the addition of the numbers you see in the brackets.<!--content-->
 
Back
Top