Jump to content

Disable and Clear Checkboxes


ciber

Recommended Posts

Hi,

 

I have tried every javascript possible, but I just cant get this damn thing to work.

Basically I need it, that when the checkbox "controller" is checked, all other checkboxes (sources) become disabled and clear if they were checked.

 

<input type="checkbox" name="controller" />  Include all sources<br><br>
<?php 
echo "<table width=\"100%\" align=\"center\" cellpadding=3 cellspacing=0> \n";
$even = 1;
$style = "sectiontablentry2";

while ($row = mysql_fetch_assoc($result)){

   	if ($even == 1) echo "<tr class=\"$style\">\n";

echo "<td>";

$name = $row['name'];

echo "<input type=\"checkbox\" value=\"$name\" id=\"sources\" onClick=\"FancyForm.update(element.getParent())\"  />$name<br>";  .......... etc ....... 

Link to comment
Share on other sites

i've used about 10 different scripts, I just can't get them to work, its not like Im lazy to do this,

I have tried every javascript possible, but I just cant get this damn thing to work.

 

its just nothing bloody works when I use it. I can't even get this damn thing to work, and its 2 lines of code:

http://lipidity.com/fancy-form/#support

 

 

Link to comment
Share on other sites

I did this all the time. Well, just practicing mostly. I mainly used it with forms though.

 

<head>
<script type="text/javascript">
function checkBox(Value){
if(Value == 1){
	document.thisForm.thisName.disabled = "disabled";
}
else{
	document.thisForm.thisName.disabled = "";
}
}
</script>
</head>
<body>
<form method="post" action="" name="thisForm">
<input type="checkbox" name="thisName" value="1" onchange="checkBox(this.value)" />
</form>

 

Basically I go from the form into the fields.

 

document.FORM.INPUT_NAME.(w/e selector; width, disabled, etc.) = "VALUE";

 

Then I check if it has that value.

 

just tested it, and it worked.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.