473,324 Members | 2,473 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

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 2479
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

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

Similar topics

1
by: J Belly | last post by:
Hi, I have a table of questions (with radio buttons) that I want to appear greyed out so that users can feel they can skip it and go on to the next page. But if they should choose to answer the...
4
by: mitch-co2 | last post by:
What I am trying to do is when someone clicks on the YES radio button I want the text field called MYTEXT to equal the text field named DATE. The below code works as long as I do NOT UN-COMMENT...
1
by: hortoristic | last post by:
We are using JavaScript to Enable/Disable certain fields on web pages based on business rules. A simple example is if when using an option type tag, and the two options are Yes and No. If YES...
4
by: enahar | last post by:
I have created RadioButtonList1 having 2 radio buttons in the list.How to make enable/disable only 1 radio button in the RadioButtonlist. Thanks for your help. Regards.
2
by: Advo | last post by:
Basically, ive got information in a table for the layout purposes, as its text for a questionnaire What i Need, is for instance when the user click a radio button, that information can be...
1
by: s.chelliah | last post by:
Hi, I am trying to use javascript, div tag and radio button to disable/enable a text box. It works fine in netscape and firefox, but in IE, the text box is not disabled when the user checks the...
6
by: Mike | last post by:
I have a form that contains 240 "products". Each Product has a TR. Each TR contains a Yes and No radio button and a Product-Qty text input. A situation exists where I have to go through all the...
3
by: Harry Haller | last post by:
I have a radio button group. When the page loads none of them are selected. OnClick selects ONE and clicking another one selects a different one - this is normal behavior. I want to modify it so...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.