468,507 Members | 1,531 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,507 developers. It's quick & easy.

How do I disable content in a text box, only if a radio button hasn't been checked

w33nie
56
I want to disable the text boxes, captain_name and captain_email, but only if the radio button, captain_guarantee, has NOT been checked.

how do i do this?

Expand|Select|Wrap|Line Numbers
  1. <form name="formTeamApplication" action="teams_process.php" method="post" onSubmit="validate()">
  2.                                                         <table width="100%" border="0" cellspacing="0" cellpadding="0">
  3.   <tr>
  4.     <td width='75'><span class='Body'>Team Name:</span></td>
  5.     <td width='150'><input width="150" class="Body" name="team_name" type="text" /></td>
  6.     <td>&nbsp;</td>
  7.     <td>&nbsp;</td>
  8.     <td>&nbsp;</td>
  9.     <td>&nbsp;</td>
  10.   </tr>
  11.   <tr>
  12.     <td width='75'><span class='Body'>Team Tag:</span></td>
  13.     <td width='150'><input width="150" class="Body" name="team_tag" type="text" /></td>
  14.     <td width='51'><span class='Body'>* optional</span></td>
  15.     <td>&nbsp;</td>
  16.     <td>&nbsp;</td>
  17.     <td>&nbsp;</td>
  18.   </tr>
  19.   <tr>
  20.       <td>&nbsp;</td>
  21.   </tr>
  22. </table>
  23. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  24.   <tr>
  25.       <td><span class='BodySmallHeading'>Please enter only the player's ingame nickname</span></td>
  26.   </tr>
  27. </table>
  28. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  29.   <tr>
  30.     <td width='75'><span class='Body'>Captain:</span></td>
  31.     <td width='150'><input width="150" class="Body" name="member1" type="text" /></td>
  32.     <td width='173'><span class='Body'>Registered on ACSSL Forums:</span></td>
  33.     <td><input value="yes" name="forums1" type="checkbox" /></td>
  34.   </tr>
  35.   <tr>
  36.     <td width='75'><span class='Body'>Member 2:</span></td>
  37.     <td width='150'><input width="150" class="Body" name="member2" type="text" /></td>
  38.     <td width='173'><span class='Body'>Registered on ACSSL Forums:</span></td>
  39.     <td><input value="yes" name="forums2" type="checkbox" /></td>
  40.   </tr>
  41.   <tr>
  42.     <td width='75'><span class='Body'>Member 3:</span></td>
  43.     <td width='150'><input width="150" class="Body" name="member3" type="text" /></td>
  44.     <td width='173'><span class='Body'>Registered on ACSSL Forums:</span></td>
  45.     <td><input value="yes" name="forums3" type="checkbox" /></td>
  46.   </tr>
  47.   <tr>
  48.     <td width='75'><span class='Body'>Member 4:</span></td>
  49.     <td width='150'><input width="150" class="Body" name="member4" type="text" /></td>
  50.     <td width='173'><span class='Body'>Registered on ACSSL Forums:</span></td>
  51.     <td><input value="yes" name="forums4" type="checkbox" /></td>
  52.   </tr>
  53.   <tr>
  54.     <td width='75'><span class='Body'>Member 5:</span></td>
  55.     <td width='150'><input width="150" class="Body" name="member5" type="text" /></td>
  56.     <td width='173'><span class='Body'>Registered on ACSSL Forums:</span></td>
  57.     <td><input value="yes" name="forums5" type="checkbox" /></td>
  58.   </tr>
  59.   <tr>
  60.     <td width='75'><span class='Body'>Member 6:</span></td>
  61.     <td width='150'><input width="150" class="Body" name="member6" type="text" /></td>
  62.     <td width='173'><span class='Body'>Registered on ACSSL Forums:</span></td>
  63.     <td><input value="yes" name="forums6" type="checkbox" /></td>
  64.   </tr>
  65.   <tr>
  66.     <td width='75'><span class='Body'>Member 7:</span></td>
  67.     <td width='150'><input width="150" class="Body" name="member7" type="text" /></td>
  68.     <td width='173'><span class='Body'>Registered on ACSSL Forums:</span></td>
  69.     <td><input value="yes" name="forums7" type="checkbox" /></td>
  70.   </tr>
  71.   <tr>
  72.     <td width='75'><span class='Body'>Member 8:</span></td>
  73.     <td width='150'><input width="150" class="Body" name="member8" type="text" /></td>
  74.     <td width='173'><span class='Body'>Registered on ACSSL Forums:</span></td>
  75.     <td><input value="yes" name="forums8" type="checkbox" /></td>
  76.   </tr>
  77. </table><br>
  78. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  79.     <tr>
  80.         <td width='25'><input value="yes" name="captain_guarantee" type="radio" /></td>
  81.         <td><span class='Body'>I am Captain of this team.</span></td>
  82.     </tr>
  83. </table>
  84. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  85.   <tr>
  86.     <td width='75'><span class='Body'>Full Name:</span></td>
  87.     <td width='150'><input width="150" class="Body" name="captain_name" type="text" /></td>
  88.     <td>&nbsp;</td>
  89.     <td>&nbsp;</td>
  90.     <td>&nbsp;</td>
  91.     <td>&nbsp;</td>
  92.   </tr>
  93.   <tr>
  94.     <td width='75'><span class='Body'>Email:</span></td>
  95.     <td width='150'><input width="150" class="Body" name="captain_email" type="text" /></td>
  96.     <td>&nbsp;</td>
  97.     <td>&nbsp;</td>
  98.     <td>&nbsp;</td>
  99.     <td>&nbsp;</td>
  100.   </tr>
  101. </table><br>
  102. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  103.     <tr>
  104.         <td width='25'><input value="yes" name="team_guarantee" type="radio" /></td>
  105.         <td><span class='Body'>By completing this form, I guarantee, that as Captain, I can and will keep this team together, and recognise that it will count against my reputation should the team fail to hold.</span></td>
  106.     </tr>
  107. </table>
  108.                             <br>
  109.     <input type="submit" value="Submit" />
  110.     <input name="reset" type="reset" id="reset" value="Clear Form">
  111.     </form>
Feb 10 '07 #1
3 2157
AricC
1,892 Expert 1GB
Have you found a solution? You need to use Javascript, let me know I can move your thread there, but basically you need to code something like if this radio button is checked then disable the control shouldn't be too hard.


Aric
Feb 13 '07 #2
w33nie
56
no i havent found a solution, but if you can do it with javascript, then please move this to the appropriate thread.
Feb 21 '07 #3
AricC
1,892 Expert 1GB
no i havent found a solution, but if you can do it with javascript, then please move this to the appropriate thread.
Here is an example of something I've done:
Expand|Select|Wrap|Line Numbers
  1.                     <script type="text/javascript">
  2.                         function ValidateCheckBox()
  3.                         {
  4.                         var chkYes = document.getElementById("chkYes");
  5.  
  6.                         if ( chkYes.checked == true )
  7.                             {
  8.                                window.location = 'some_images.php';   
  9.                             }
  10.                             else 
  11.                             {
  12.                             alert("If You Would Like To Proceed You Must Check The Box")
  13.                             }
  14.  
  15.                         }
  16.  
  17.  
  18.                     </script>
  19.  
Except instead of moving to a new page say document.yourform.textbox.disabled = true or something to the effect. Let me know if your stuck.
Feb 21 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by J Belly | last post: by
1 post views Thread by hortoristic | last post: by
6 posts views Thread by Mike | last post: by
3 posts views Thread by Harry Haller | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.