albertkao — 2010-02-23T16:35:02-05:00 — #1
My JSP web page has many checkboxes.
What is web page source code look like when clicking one checkbox will submit only one checkbox value (not the whole form) immediately?
i.e. toggling one checkbox will send the info that only that checkbox is toggled.
This does not work because clicking one checkbox will send the whole page
<form name="myform" method="post">
<input type="checkbox" name="choice" value="1" onclick="submit();">
<input type="checkbox" name="choice" value="2" onclick="submit();">
<input type="checkbox" name="choice" value="3" onclick="submit();">
felgall — 2010-02-23T20:37:32-05:00 — #2
If each checkbox is a separate form then give each their own separate form tag.
albertkao — 2010-03-11T10:41:55-05:00 — #3
Is it possible to have only one form?
paul_wilkins — 2010-03-11T15:32:36-05:00 — #4
It is possible to have only one form if you want to submit to only one page.
The better alternative is to make the server-side smarter, so that it directs the form submission where it needs to go, or to use multiple forms on the page.
The danger of submitting when a checkbox is clicked is that it conflicts with how people know web forms work on the 1000+ other web forms they have recently used.