ciber Posted June 29, 2009 Share Posted June 29, 2009 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 More sharing options...
gevans Posted June 29, 2009 Share Posted June 29, 2009 Firstly an id is meant to be assigned individually if you want to use id here, each input requries a different one. Also without showing your javascript I can't help. Link to comment https://forums.phpfreaks.com/topic/164093-disable-and-clear-checkboxes/#findComment-865626 Share on other sites More sharing options...
ciber Posted June 29, 2009 Author Share Posted June 29, 2009 i dont have a javascript nothing works, I dont even know where to start anymore Link to comment https://forums.phpfreaks.com/topic/164093-disable-and-clear-checkboxes/#findComment-865643 Share on other sites More sharing options...
gevans Posted June 29, 2009 Share Posted June 29, 2009 http://www.shawnolson.net/a/639/select-all-checkboxes-in-a-form-with-javascript.html http://www.somacon.com/p117.php http://www.hscripts.com/scripts/JavaScript/select-all-checkbox.php Google Link to comment https://forums.phpfreaks.com/topic/164093-disable-and-clear-checkboxes/#findComment-865651 Share on other sites More sharing options...
ciber Posted June 29, 2009 Author Share Posted June 29, 2009 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 https://forums.phpfreaks.com/topic/164093-disable-and-clear-checkboxes/#findComment-865667 Share on other sites More sharing options...
ciber Posted June 29, 2009 Author Share Posted June 29, 2009 urgh, just leave it, i give up on this idea Link to comment https://forums.phpfreaks.com/topic/164093-disable-and-clear-checkboxes/#findComment-865672 Share on other sites More sharing options...
Twister1004 Posted June 29, 2009 Share Posted June 29, 2009 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 https://forums.phpfreaks.com/topic/164093-disable-and-clear-checkboxes/#findComment-865733 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.