aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes click one checkbox will submit only one checkbox value (not the whole form)  immediately Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "click one checkbox will submit only one checkbox value (not the whole form)  immediately" Watch "click one checkbox will submit only one checkbox value (not the whole form)  immediately" New topic
Author

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

albert kao
Ranch Hand

Joined: Feb 04, 2010
Posts: 249
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

Joined: Jan 10, 2002
Posts: 61623
    
  67

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
albert kao
Ranch Hand

Joined: Feb 04, 2010
Posts: 249
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

Joined: Jan 10, 2002
Posts: 61623
    
  67

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.
 
 
subject: click one checkbox will submit only one checkbox value (not the whole form) immediately