• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

click one checkbox will submit only one checkbox value (not the whole form) immediately

 
albert kao
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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();">
...
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65229
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't just submit part of a form.

You can either generate a request with Ajax specifying only the data for the single checkbox, or submit the form after disabling all the other controls.

In either case this is a JavaScript question, not a JSP question. Topic moved.
 
albert kao
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:You can't just submit part of a form.

You can either generate a request with Ajax specifying only the data for the single checkbox, or submit the form after disabling all the other controls.

In either case this is a JavaScript question, not a JSP question. Topic moved.


What is the Ajax source code specifying only the data for the single checkbox?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65229
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should know better than that by now... you write the code, and we help you with it -- not write it for you.

Perhaps this article might help.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic