This question already has an answer here:
I have a very simple question - how do I get a form to submit when I change the status of a checkbox
Here is my code
<form name="formName" id="formName" action="<?php echo $_SERVER['PHP_SELF'];?>" method="get">
<input type ="checkbox" name="categories1" value = "1" onClick="submit();">1</input>
</form>
in addition to submit() I have tried:
but none of these work. When I check or uncheck the box nothing happen
any clues?
</div>
Refer to the form name attribute:
document.formName.submit()
This works for me in both FF and IE:
<form name="formName" id="formName" action="" method="get">
<input type ="checkbox" name="categories1" value = "1" onclick="this.form.submit();">1</input>
</form>
found the problem - I had a submit button named submit - see Javascript form submit: Object doesn't support this property or method (IE7) for similar soln.
You can try the following
<form name="formName" id="formName" action="" method="get">
<input type ="checkbox" name="categories1" value = "1" **onchange**="this.form.submit();">1</input>
</form>