Well, this has nothing to do with prototype, but you might use
Prototype's Ajax.Request[1] to send only the data from the checked
input (as follow):
e.g.:
<form name="myform" method="post">
<input type="checkbox" name="choice" value="1" onclick="myMubmit(this);">
<input type="checkbox" name="choice" value="2" onclick="myMubmit(this);">
<input type="checkbox" name="choice" value="3" onclick="myMubmit(this);">
</form>
function myMubmit(input) {
new Ajax.Request(url, {
method: 'post',
parameters: input.name +'='+input.value,
onSuccess: function(r) {
// show the result or do something wild
}
});
}
You can also use Prototype's Event.observe[2] to check the click event
on each checkbox.
[1] http://api.prototypejs.org/ajax/ajax/request.html
[2] http://api.prototypejs.org/dom/event.html#observe-class_method
Cheers,
On Thu, Mar 11, 2010 at 12:50 PM, albert kao <[email protected]> wrote:
> What is the function submitjustthisone() look like?
>
> On Feb 23, 9:54 pm, Al C <[email protected]> wrote:
>> Albert - change the onclick to point to a javascript
>> e.g.,
>> <input type="checkbox" name="choice"value="1"
>> onclick="submitjustthisone();">
>>
>> Of course, youwillalso need to write this function
>> <script>
>> function submitjustthisone(){
>> //do the stuff you need to do}
>>
>> </script>
>>
>> On Feb 23, 4:58 pm, albert kao <[email protected]> wrote:
>>
>>
>>
>> > My JSP web page has many checkboxes.
>> > What is web page source code look like when clickingonecheckboxwill
>> >submitonlyonecheckboxvalue(not the whole form) immediately?
>> > i.e. togglingonecheckboxwillsend the info thatonlythatcheckbox
>> > is toggled.
>> > This does not work because clickingonecheckboxwillsend 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();">
>> > ...
>
> --
> You received this message because you are subscribed to the Google Groups
> "Prototype & script.aculo.us" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/prototype-scriptaculous?hl=en.
>
>
--
D. G. Rodrigues
Consultoria e Auditoria em Desenvolvimento de Softwares
Believe nothing, no matter where you read it or who said it, unless it
agrees with your own reason and your own common sense.
--
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.