473,473 Members | 1,918 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Based on Particular Radio Button Selection Hide/Unhide Textboxes,Labels etc.

5 New Member
I have two Radio buttons. radio_date & radio _reg.

Initially radio_date is checked by default.(On form load)....So i want to display two textboxes & related labels.All this data is in a table.As shown below.

Expand|Select|Wrap|Line Numbers
  1.       <tr  > 
  2.         <td >Date From   
  3.  
  4.          <input  type="text" name="date_from" id="date_from" value="<?php if($_POST['date_from'] != "") {print $_POST['date_from'];} else {print date('d-m-Y');} ?>" class="textboxes1" onClick="scwShow(this,event); " readonly="yes"/>
  5.                         To        
  6.          <input  type="text" name="date_to" id="date_to" value="<?php if($_POST['date_to'] != "") {print $_POST['date_to'];} else {print date('d-m-Y');}?>" class="textboxes1" onClick="scwShow(this,event);"/>
  7.          </td>
  8.       </tr> 


But if the user selects radio_reg I want the above HTML code to disablle,ie textboxes do not show etc .& radio_reg related select & labels show.

Expand|Select|Wrap|Line Numbers
  1.   <tr>
  2.   <td  ....> Some thing </td>
  3.  <td  ....> Some thing </td>
  4. </tr>


I wan this to work onClick ...when user clicks on the radio button.
Mar 29 '10 #1

✓ answered by phvfl

If you want to hide a group of controls the easiest way is to hide a parent element which only contains those controls. This is not easy due to you using tables.

Since it seems that you want to leave the table cells visible you will need to get a reference to each element and then set the style.display property to 'none' e.g.
Expand|Select|Wrap|Line Numbers
  1. /* Set the variable el to the html element using getElementById or similar
  2. el.style.display = 'none';
  3.  

1 3368
phvfl
173 Recognized Expert New Member
If you want to hide a group of controls the easiest way is to hide a parent element which only contains those controls. This is not easy due to you using tables.

Since it seems that you want to leave the table cells visible you will need to get a reference to each element and then set the style.display property to 'none' e.g.
Expand|Select|Wrap|Line Numbers
  1. /* Set the variable el to the html element using getElementById or similar
  2. el.style.display = 'none';
  3.  
Mar 29 '10 #2

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

Similar topics

3
by: Owen Funkhouser | last post by:
I have a form with three radio options. And I have three buttons: <input type="submit" name="mainform_action" value="Edit Data"> <input type="submit" name="mainform_action" value="View Data">...
3
by: alexz | last post by:
I want to check information is entered in the form with javascrip, based on a radio button or a checkbox. For example I have 2 radio buttons Yes and No. If "Yes" is click then check if the fname...
3
by: ewitkop90 | last post by:
Here is my code: <SCRIPT> function transportchange(transport) { if (framenewinstall.Helpdesk.checked) framenewinstall.Helpdesk.checked=false; if (framenewinstall.CircuitNumber.checked)...
2
by: lltaylor | last post by:
Hello, I am trying to create a form which when initially displayed only has 2 radio buttons. Then based on which radio button you select the appropriate form appears below the radio buttons. ...
3
by: Jason | last post by:
I am new to WebForms and am far more comfortable with WinForms. I am wondering how simple things such as showing/hiding a label and textbox can be accomplished if a certain Radiobutton option is...
2
by: dpazza | last post by:
Hi, I'm creating a quiz on using a form in VB 2005 express. I have four sets of questions and answers (labels and radio buttons) and I change between which set of questions is currently shown on...
10
by: mukeshrasm | last post by:
Hi I have a html in which there is two selection box and two radio button. Radio buttion is of array type. What I want if user will click the radio button then only he/she be able to make...
4
by: research_stuff | last post by:
I have researched unhiding text using Javascript. I found examples unhiding text boxes. I need to unhide text when a radio button has been selected. Can someone point me to an example? ...
3
by: NDayave | last post by:
How do, I have a form with a number of textboxes that hide and unhide depending on a number or Laps of a Race. Currently I have this code to make them hide and unhide: Dim LapBox as String ...
0
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,...
0
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...
1
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
0
muto222
php
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.