This project is archived and is in readonly mode.

#674 ✓invalid
Fábio M. Costa

Element send() with '' urls

Reported by Fábio M. Costa | May 21st, 2009 @ 03:59 PM | in 2.0 (closed)

I know Element.send s intended to be used in any container of inputs, but it could try to get the form 'action' attribute if the other url options were not set, so the code is now:

javascript@@@
... Element.implement({

send: function(url){
    var sender = this.get('send');
    sender.send({data: this, url: url || sender.options.url});
    return this;
},

...


And my proposal is:


javascript@@@ Element.implement({

send: function(url){
    var sender = this.get('send');
    sender.send({data: this, url: url || sender.options.url || this.action || ''});
    return this;
},</code>



The '' in the end is important because if not present it will result in a null url on the Request and will fail.

'' url is cool because it references the current page, witch is what is deserved if no url is passed.

Comments and changes to this ticket

  • Fábio M. Costa

    Fábio M. Costa May 21st, 2009 @ 06:34 PM

    Hmm Sorry guys for my error.
    send() gets the action of the form rightly. But still the '' should work without error.
    So the ticket and code is partially incorrect, the right code for the fix im proposing is:

    @@@javascript ...

    Element.implement({

    send: function(url){
        var sender = this.get('send');
        sender.send({data: this, url: url || sender.options.url || ''});
        return this;
    },
    

    ...

    
    Witch will no longer get a null url in cases were you dont define it.


    Milestone should be changed to 1.2.3 IMHO...
  • Fábio M. Costa

    Fábio M. Costa May 21st, 2009 @ 06:36 PM

    • Title changed from “Element send should try to get the form action” to “Element send() with '' urls”
    • Tag changed from action, element, form, send to element, send

    Formatting error... and changing title and tags

    Element.implement({
    
    send: function(url){
        var sender = this.get('send');
        sender.send({data: this, url: url || sender.options.url || ''});
        return this;
    },
    
  • Fábio M. Costa

    Fábio M. Costa May 21st, 2009 @ 10:16 PM

    • Assigned user changed from “Valerio” to “David Walsh”

    Im really really sorry about this, '' urls doenst work as i expected... you can close this as invalid, please.

  • David Walsh

    David Walsh May 21st, 2009 @ 10:51 PM

    • State changed from “new” to “invalid”

Create your profile

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

Shared Ticket Bins

People watching this ticket

Tags

Pages