CheckBox Help - Techist - Tech Forum

Go Back   Techist - Tech Forum > Computer Software > Microsoft Windows and Software
Click Here to Login
Closed Thread
 
Thread Tools Display Modes
 
Old 12-29-2006, 06:36 AM   #1 (permalink)
Newb Techie
 
Join Date: Apr 2006
Posts: 32
Default CheckBox Help

Hello all

I have a form which has alot of radio buttons and check box for each group (4 or 5)
I want to enable these boxes when I uncheck the check box and restore it back.
can I do with javaScript?
any suggestion
THanks
__________________

houssam_ballout is offline  
Old 12-29-2006, 11:13 AM   #2 (permalink)
It's all just 1s and 0s
 
office politics's Avatar
 
Join Date: Jan 2004
Location: in the lab
Posts: 6,555
Send a message via MSN to office politics
Default

use
document.getElementById("rent").style.display = 'block';
document.getElementById("rent_req").style.display = 'none';

to hide or display the buttons

see attached example

Code:
<script>
function checkrent(veh, box, obox) {
  //alert("veh - " + veh + "\nBox - " + box.checked + "\noBox - " + obox.checked);
  if ((box.checked == true) && (obox.checked == true)) {
    document.getElementById("rent").style.display = 'block';
    document.getElementById("rent_req").style.display = 'none';
  } else {
    document.getElementById("rent").style.display = 'none';
    document.getElementById("rent_req").style.display = 'block';  
  }
}
</script>
<form name=app>
<p class="MsoNormal"><font size="4"></font><span style="font-size: 10.0pt"><font size="4"><input type="checkbox" name="veh1_comp" onclick="if (document.app.veh1_coll.checked == true) {alert('You can not select collision coverage without selecting compreshensive coverage');this.checked=true;}checkrent('veh1', this, document.app.veh1_coll);" value="ON"></font></span></p>
		<p class="MsoNormal"><font size="4">Comp</font></p>
		<p class="MsoNormal"><font size="4"></font><span style="font-size: 10.0pt"><font size="4"><input type="checkbox" name="veh1_coll" onclick="if (document.app.veh1_comp.checked == false) document.app.veh1_comp.checked = true;checkrent('veh1', this, document.app.veh1_comp);" value="ON"></font></span></p>
		<p class="MsoNormal"><font size="4">Coll</font></p>
<hr>
<div id="rent" style='display: none'><p class="MsoNormal"><span style="font-size: 10.0pt"><font size="4"><input type="checkbox" name="veh1_rent" value="ON"></font></span><p class="MsoNormal"><font size="4">
		Rental Reimbursement</font></p>
		<p class="MsoNormal"></p>
		<font size="4">$ <span style="font-size: 10.0pt"><input name="veh1_rent_per_day" maxlength=4 size="4"></span> 
		per day /</font><p class="MsoNormal">
		<span style="font-size: 10.0pt"><font size="4"> 
		 
		<input name="veh1_rent_days" maxlength=3 size="4"></font></span><font size="4">days</font></div><div id="rent_req"><p class="MsoNormal"><font size="4">
		Rental Reimbursement requires Comp &amp; Coll Coverage</font></p></div>
</form>
office politics is offline  
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Copyright 2002- Social Knowledge, LLC All Rights Reserved.

All times are GMT -5. The time now is 07:00 PM.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.