View Full Version : checkbox disability
Techno
06-29-2007, 07:42 AM
I am using Server side code (ASP.NET) to make a checkbox enabled/disabled.
the problem is from the clientside, it sees that just fine BUT if i wish to enable or disable that checkbox (on the client side), it doesnt seem to do it! Any ideas what is causing the problem and how to sort it?
I am simply using:
checkboxToConfigure.disabled = true; //or false;
Horus_Kol
06-29-2007, 08:26 PM
its hard to debug code when there is only one line...
how is checkboxToConfigure set as a variable? what event affects the enabling/disabling of the checkbox?
have you used an error console to check for javascript errors which might be stopping the script and preventing it from getting that far?
at the very least, we need to see:
1. the HTML element and attributes of the checkbox itself
2. the whole function(s) which are fired by the event that is supposed to switch the checkbox between enabled/disabled
Techno
06-30-2007, 04:34 AM
I found the problem. The way ASP.NET renders the disabled control inside a span making that disabled, so I had to tell javascript to look at that parentElement and disable it - it then started to work fine :)
in addition to that, the solution I was making had to use the jscript declaration as:
<script language="javascript">
and NOT:
<script lang="javascript">
coothead
06-30-2007, 05:43 AM
Hi there Techno,
<script language="javascript">
...is deprecated in favour of...
<script type="text/javascript">
...which should, certainly, be used if code validation is a concern. :agree:
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.