473,725 Members | 2,017 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

w33nie
56 New Member
I want to disable the text boxes, captain_name and captain_email, but only if the radio button, captain_guarant ee, 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 2498
AricC
1,892 Recognized Expert Top Contributor
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 New Member
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 Recognized Expert Top Contributor
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.yourfo rm.textbox.disa bled = 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
16513
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 questions, I'd want them to uncheck a checkbox so that the table would appear white. How do I do this? (If I can also disable the radio buttons at the same time, that would even be better.) Also, I'd need it to work in both IE and...
4
4131
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 the NO radio button, once I do that it will not work. Any help would be greatly appreciated. Mitch
1
4252
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 is selected - enable a field to use the M$ Datepicker. Using the code below works for most of our fields, however the problem is that when the field is re-enabled - it remembers the original date or data prior to it being disabled - despite the...
4
2958
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
3492
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 hidden. I tried <div id="myarea" style="visibility:hidden"><STRONG><font color="#4475AA"Question 2:</font></STRONG></divetc
1
24745
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 radio button. Note that I am using two div statements. Any other solutions also wellcome. <html>
6
2318
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 products and check the No radio button for all the products. In javascript, that is easy enough. When the No radio button is clicked, I have to put '0' in the Product-Qty text input, and disable the Product-Qty text input. I create an array of...
3
5845
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 that clicking on a radio which is already selected will deselect it so that none of the group are selected. I can get the required behavior with a double-click: ondblclick="this.checked=!(this.checked);"
0
8888
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8752
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8096
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6702
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6011
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4517
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4782
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3221
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2634
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.