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
https://forums.phpfreaks.com/topic/164093-disable-and-clear-checkboxes/
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

 

 

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.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.