This project is archived and is in readonly mode.

#228 ✓resolved
iSac

Form.Request Documentation Lists Wrong Argument Type

Reported by iSac | January 5th, 2010 @ 07:03 PM | in 1.2.4.3

The documentation for Form.Request (http://mootools.net/docs/more/Forms/Form.Request) says that onSend event handlers are passed two arguments, the second being an object with the data that was sent with the form. It seems to be passed the string version of said object, i.e. the full query string (including form input values and the extra data passed in with the extraData option).

The code that sends the form and fires the event is:

    send: function(){
        var str = this.element.toQueryString().trim();
        var data = $H(this.options.extraData).toQueryString();
        if (str) str += "&" + data;
        else str = data;
        this.fireEvent('send', [this.element, str]);
        this.request.send({data: str});
        return this;
    }

I think adding a str.parseQueryString() (http://mootools.net/docs/more/Native/String.QueryString#String:pars...) would fix it, or changing the Form.Request docs. I put the former fix below. Thanks!

    send: function(){
        var str = this.element.toQueryString().trim();
        var data = $H(this.options.extraData).toQueryString();
        if (str) str += "&" + data;
        else str = data;
        this.fireEvent('send', [this.element, str.parseQueryString()]);
        this.request.send({data: str});
        return this;
    }

Comments and changes to this ticket

Create your profile

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

The MooTools Extensions

People watching this ticket

Pages