|
 |
asp_databases thread: Disable checkbox
Message #1 by "chetanp" <chetanpp@h...> on Mon, 26 Nov 2001 21:40:11
|
|
Thanks to those who helped earlier
What i want to do is to have two checkbox in one line and the second
checkbox is disable from the beginning...and will only be enabled if the
first box is checked...
<form>
<table>
<tr>
<td><input type="checkbox" name="rm" ></td>
<td>...</td>
<td>...</td>
<td>input type="checkbox" name="ss" DISABLED></td>
</tr>
</table>
</form>
How do i do this...of enableing the second box if and only if the first
box is checked...
Much thanks :)
Message #2 by David Cameron <dcameron@i...> on Tue, 27 Nov 2001 09:06:38 +1100
|
|
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C176C6.A465906A
Content-Type: text/plain
Javascript.
<script language="javascript">
function ChangeBox(curForm) {
if (curForm.checkbox1.checked) { curForm.checkbox2.disabled = false;
}
}
</script>
<form>
<input type="checkbox" name="checkbox1" onclick="ChangeBox(this.form);">
<input type="checkbox" name="checkbox2" disabled>
</form>
Code may not work, but you get the idea. Also I am pretty sure that disabled
(and also readonly) only works for IE4+ and possibly NS6+, (not sure about
other browswers), which means that if you use this code not only will the
box not be disabled it will also cause a javascript error when the function
runs. You will want to also add in some handling for different browsers and
another function for the onclick event for checkbox2.
regards
David Cameron
nOw.b2b
dcameron@i...
-----Original Message-----
From: chetanp [mailto:chetanpp@h...]
Sent: Tuesday, 27 November 2001 7:40 AM
To: ASP Databases
Subject: [asp_databases] Disable checkbox
Thanks to those who helped earlier
What i want to do is to have two checkbox in one line and the second
checkbox is disable from the beginning...and will only be enabled if the
first box is checked...
<form>
<table>
<tr>
<td><input type="checkbox" name="rm" ></td>
<td>...</td>
<td>...</td>
<td>input type="checkbox" name="ss" DISABLED></td>
</tr>
</table>
</form>
How do i do this...of enableing the second box if and only if the first
box is checked...
Much thanks :)
$subst('Email.Unsub')
Message #3 by "Philip Sayers" <philipsayers@m...> on Mon, 26 Nov 2001 17:23:34 -0500
|
|
Javascript
www.irt.org
goto javascript FAQ's then choose "forms"
-----Original Message-----
From: chetanp [mailto:chetanpp@h...]
Sent: Monday, November 26, 2001 9:40 PM
To: ASP Databases
Subject: [asp_databases] Disable checkbox
Thanks to those who helped earlier
What i want to do is to have two checkbox in one line and the second
checkbox is disable from the beginning...and will only be enabled if the
first box is checked...
<form>
<table>
<tr>
<td><input type="checkbox" name="rm" ></td>
<td>...</td>
<td>...</td>
<td>input type="checkbox" name="ss" DISABLED></td>
</tr>
</table>
</form>
How do i do this...of enableing the second box if and only if the first
box is checked...
Much thanks :)
philipsayers@m...
$subst('Email.Unsub')
Message #4 by Kyle Burns <kburns@c...> on Tue, 27 Nov 2001 08:45:19 -0500
|
|
Use the ONCLICK attribute of "rm" and set it to a JavaScript function that
enables/disables "ss" based on the state of "rm".
=================================
Kyle M. Burns, MCSD, MCT
ECommerce Technology Manager
Centra Credit Union
kburns@c...
-----Original Message-----
From: chetanp [mailto:chetanpp@h...]
Sent: Monday, November 26, 2001 4:40 PM
To: ASP Databases
Subject: [asp_databases] Disable checkbox
Thanks to those who helped earlier
What i want to do is to have two checkbox in one line and the second
checkbox is disable from the beginning...and will only be enabled if the
first box is checked...
<form>
<table>
<tr>
<td><input type="checkbox" name="rm" ></td>
<td>...</td>
<td>...</td>
<td>input type="checkbox" name="ss" DISABLED></td>
</tr>
</table>
</form>
How do i do this...of enableing the second box if and only if the first
box is checked...
Much thanks :)
$subst('Email.Unsub')
Message #5 by Colin.Montgomery@C... on Tue, 27 Nov 2001 14:02:44 -0000
|
|
not sure what events can be used, but you may be better using onChange (or
whatever is the equivalent) so as the user can use tab/spacebar to get to
and change the checkbox.
Colin
-----Original Message-----
From: Kyle Burns [mailto:kburns@c...]
Sent: 27 November 2001 13:45
To: ASP Databases
Subject: [asp_databases] RE: Disable checkbox
Use the ONCLICK attribute of "rm" and set it to a JavaScript function that
enables/disables "ss" based on the state of "rm".
=================================
Kyle M. Burns, MCSD, MCT
ECommerce Technology Manager
Centra Credit Union
kburns@c...
-----Original Message-----
From: chetanp [mailto:chetanpp@h...]
Sent: Monday, November 26, 2001 4:40 PM
To: ASP Databases
Subject: [asp_databases] Disable checkbox
Thanks to those who helped earlier
What i want to do is to have two checkbox in one line and the second
checkbox is disable from the beginning...and will only be enabled if the
first box is checked...
<form>
<table>
<tr>
<td><input type="checkbox" name="rm" ></td>
<td>...</td>
<td>...</td>
<td>input type="checkbox" name="ss" DISABLED></td>
</tr>
</table>
</form>
How do i do this...of enableing the second box if and only if the first
box is checked...
Much thanks :)
$subst('Email.Unsub')
colin.montgomery@c...
$subst('Email.Unsub')
*******
This message and any attachment are confidential and may be privileged or otherwise protected from disclosure. If you are not the
intended recipient, please telephone or email the sender and delete this message and any attachment from your system. If you are
not the intended recipient you must not copy this message or attachment or disclose the contents to any other person.
For further information about Clifford Chance please see our website at http://www.cliffordchance.com or refer to any Clifford
Chance office.
Message #6 by Kyle Burns <kburns@c...> on Tue, 27 Nov 2001 09:56:35 -0500
|
|
Good point. Your post got me thinking about the Click behavior and the
spacebar. The event system (at least in IE5.5) treats the control being
toggled the same whether a mouse click or the spacebar is used to toggle it.
This is probably cross-browser because HTML specs cover accesibility and
many possible user agents would not include a mouse. The following code
disables/enables the second checkbox based on the checked attribute of the
first through the onclick event:
<html>
<head>
<title>Test Radio</title>
<script language="JavaScript" type="text/javascript">
function rm_onClick()
{
document.forms[0].ss.disabled
!document.forms[0].rm.checked;
}
</script>
</head>
<body>
<form>
<input type="checkbox" name="rm" onclick="rm_onClick()" />Click Me
<input type="checkbox" name="ss" disabled />Should Enable Me
</form>
</body>
</html>
=================================
Kyle M. Burns, MCSD, MCT
ECommerce Technology Manager
Centra Credit Union
kburns@c...
-----Original Message-----
From: Colin.Montgomery@C...
[mailto:Colin.Montgomery@C...]
Sent: Tuesday, November 27, 2001 9:03 AM
To: ASP Databases
Subject: [asp_databases] RE: Disable checkbox
not sure what events can be used, but you may be better using onChange (or
whatever is the equivalent) so as the user can use tab/spacebar to get to
and change the checkbox.
Colin
-----Original Message-----
From: Kyle Burns [mailto:kburns@c...]
Sent: 27 November 2001 13:45
To: ASP Databases
Subject: [asp_databases] RE: Disable checkbox
Use the ONCLICK attribute of "rm" and set it to a JavaScript function that
enables/disables "ss" based on the state of "rm".
=================================
Kyle M. Burns, MCSD, MCT
ECommerce Technology Manager
Centra Credit Union
kburns@c...
-----Original Message-----
From: chetanp [mailto:chetanpp@h...]
Sent: Monday, November 26, 2001 4:40 PM
To: ASP Databases
Subject: [asp_databases] Disable checkbox
Thanks to those who helped earlier
What i want to do is to have two checkbox in one line and the second
checkbox is disable from the beginning...and will only be enabled if the
first box is checked...
<form>
<table>
<tr>
<td><input type="checkbox" name="rm" ></td>
<td>...</td>
<td>...</td>
<td>input type="checkbox" name="ss" DISABLED></td>
</tr>
</table>
</form>
How do i do this...of enableing the second box if and only if the first
box is checked...
Much thanks :)
$subst('Email.Unsub')
colin.montgomery@c...
$subst('Email.Unsub')
*******
This message and any attachment are confidential and may be privileged or
otherwise protected from disclosure. If you are not the intended recipient,
please telephone or email the sender and delete this message and any
attachment from your system. If you are not the intended recipient you must
not copy this message or attachment or disclose the contents to any other
person.
For further information about Clifford Chance please see our website at
http://www.cliffordchance.com or refer to any Clifford Chance office.
$subst('Email.Unsub')
|
|
 |