#17 ✓invalid
Anthony Hildoer

Serialization Not Handling Multiple Submits in Single Form

Reported by Anthony Hildoer | April 15th, 2008 @ 11:44 PM

When serializing a form with multiple submits, only the submit which was clicked should be serialized. There is a web page that has documented this problem with a an example. It compares prototype, among some other javascript libraries, to native browser serialization. The problem can be recreated there.

To recreate problem:

-Go to: http://www.malsup.com/jquery/for... (though this page shows the problem on prototype 1.5.1, the problem remains even in prototype 1.6.0.2)

-Scroll down to the second to last section which reads "Submit elements should only appear in the query string when they are the element used to submit the form. Only..."

-In that section are 4 submits. Use any one of them.

-You are now at the top of the page, and you can compare the serialization of prototype to that of the browsers native serialization.

-Click 'check your browser's native form serialization'

-Click 'Test Prototype 1.5.1_rc2'

-Compare the serialization strings, you will see that the native serialization only includes the submit element that was clicked. Prototype, however, includes all submit items, which leaves the processing script unable to determine which submit was used to submit the form.

Comments and changes to this ticket

  • Anthony Hildoer

    Anthony Hildoer April 15th, 2008 @ 11:50 PM

    One follow-up, for HTML 4.01, here is the standard that recommends how multiple submits are to be handled. See the second bullet under the section "However:"

    http://www.w3.org/TR/html401/int...

  • John-David Dalton

    John-David Dalton April 16th, 2008 @ 12:58 AM

    • Title changed from “Serialization Not Handling Multiple Submits in Single Form” to “[Dup Trac #5031] Serialization Not Handling Multiple Submits in Single Form”

    This is a dup of a ticket in trac that has several patches:

    http://dev.rubyonrails.org/ticke...

  • Anthony Hildoer

    Anthony Hildoer April 16th, 2008 @ 01:11 AM

    I don't use Ruby on Rails. Those solutions are all for Ruby on Rails. Unless prototype is only meant to be used with Ruby, I still consider this a bug with prototype.

  • John-David Dalton

    John-David Dalton April 16th, 2008 @ 03:16 AM

    That site, until this week or so, was the place to post Prototype related tickets. The ticket and patch is related directly to Prototype, not RoR, and I believe this issue. Thank you for reporting this issue I am simply marking this ticket as a duplicate so the devs don't waste time spinning there gears on an issue that has already been addressed and thoroughly discussed.

  • John-David Dalton

    John-David Dalton April 16th, 2008 @ 09:01 PM

    • Title changed from “[Dup Trac #5031] Serialization Not Handling Multiple Submits in Single Form” to “[Invalid][Dup Trac #5031] Serialization Not Handling Multiple Submits in Single Form”

    As per the standard: http://www.w3.org/TR/html401/int....13.3

    Only the submit button clicked or in this case passed via myForm.serialize({submit: mySubmit}) will be serialized.

  • John-David Dalton

    John-David Dalton April 16th, 2008 @ 09:32 PM

    • correction: in prototype 1.6.0.2, myForm.serialize({submit: elementName, hash:false});

    This still leaves error for submit buttons with the same name, but that is a sep ticket.

  • Anthony Hildoer

    Anthony Hildoer April 16th, 2008 @ 09:36 PM

    I can't find that separate ticket that deals with submits with the same name. Can you link me to it? I would like to watch it for a resolution.

  • Tobie Langel

    Tobie Langel April 16th, 2008 @ 10:49 PM

    • State changed from “new” to “invalid”
    • Title changed from “[Invalid][Dup Trac #5031] Serialization Not Handling Multiple Submits in Single Form” to “Serialization Not Handling Multiple Submits in Single Form”

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

The Prototype JavaScript library.

Shared Ticket Bins

People watching this ticket

Pages