#1386 ✓ duplicate
Jorgen Rydenius

Regression: prototype.js 1.7.1 Form.serialize() is incompatible with multiselects

Reported by Jorgen Rydenius | September 19th, 2012 @ 03:39 PM

This code (serialization of a simple HTML form with a multiple select field) works in prototype.js 1.7 but fails on 1.7.1:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="sv" xml:lang="sv">
    <head>
        <title>Test case</title>
        <script type="text/javascript" src="prototype.js"></script>
    </head>
    <body>
        <form id="myForm" name="myForm" action="#">
            <select name="myData" multiple="multiple">
                <option value="1">1</option>
                <option value="2">2</option>
            </select>
        </form>
        <script type="text/javascript">
            alert($('myForm').serialize());
        </script>
    </body>
</html>

With 1.7.1, the call to serialize() fails with "Uncaught TypeError: Object has no method 'gsub'" on line 5809 of prototype.js. Switching to serialize(true) works though, because then another accumulator is used.

Comments and changes to this ticket

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