#66 enhancement
Ben Sommerville

Form.request does not pass options to form.serialize

Reported by Ben Sommerville | May 1st, 2008 @ 09:18 AM | in 1.6.1

Form.request calls Form.serialize to get the parameters to post. However it does not pass serialize the options parameter it received. This makes it impossible to specify which submit button was pressed (using options.submit).

A fixed version of Form.request is below


    request: function(form, options)
    {
        form = $(form),options = Object.clone(options || { });

        var params = options.parameters, action = form.readAttribute('action') || '';
        if (action.blank()) action = window.location.href;
        options.hash = true;
        options.parameters = form.serialize(options);

        if (params)
        {
            if (Object.isString(params)) params = params.toQueryParams();
            Object.extend(options.parameters, params);
        }

        if (form.hasAttribute('method') && !options.method)
            options.method = form.method;

        return new Ajax.Request(action, options);
    }


Comments and changes to this ticket

Please Login or create a free account to add a new comment.

You can update this ticket by sending an email to from your email client. (help)

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

Tags