View Single Post
 
Old December 7th, 2006, 04:01 AM
tmstark tmstark is offline
Registered User
 
Join Date: Dec 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello. I'm trying to adapt the code you gave above to do something simpler, but I'm not getting what I need.

I want the Anonymous: Yes or No radio buttons to enable/disable TWO textfields: Name and Email. If Anonymous is selected, i.e., "Yes", both the Name and Email textfields should be disabled. If "No" is selected, both the Name and Email textfields should be enabled.

Here is the code. I'm lost in it. Help appreciated.

<html><head></head><body bgcolor=ECECEC>
<br><br>




<script type="text/javascript">
function HideOrShowStuff(controlToHide)
{

    if (document.getElementById)
    {
            document.getElementById('region1').disabled=true
            document.getElementById('region1').disabled=true
            if(controlToHide==2)
            {




            }
            else
            {
            document.getElementById('region' + controlToHide).disabled = false;
            }
    }
    else
    {
        alert('Sorry, your browser doesn\'t support this');
    }
}

</script>


<form METHOD=post ACTION="/cgi-sys/FormMail.cgi">


Recipient: <select name="recipient" width=20>
<option value="blah@blah.com">Blah 1</option>
<option value="blah@blah.com">Blah 2</option>
</select><br><br>

Anonymous: <input name="anonymous" type="radio" value="Yes" onclick="HideOrShowStuff(2)"/>Yes
<input name="anonymous" type="radio" value="No" onclick="HideOrShowStuff(1)"/>No<br>
Name: <input name="name" id="region1" disabled type="text" size="29" /><br>
Email:&nbsp; <input name="name" id="region1" disabled type="text" size="29" />
<br>





<br>
<input type=text name="subject"><br>
<input type=text name="email"><br>
<input type=text name="realname"><br>
<INPUT type="Submit" value="Submit">




</form>