This project is archived and is in readonly mode.

#863 ✓wontfix
Nick Nagels

Form.Request can't change update element property

Reported by Nick Nagels | March 5th, 2010 @ 04:22 PM

If you try to add a new Form.Request object to a form which already had a Form.Request object attached, it will execute with the old properties. This is most likely due to the Occlude implementation (return this.occluded;) you see below in the initializer.

initialize: function(form, update, options) {

this.element = document.id(form);
if (this.occlude()) return this.occluded;
this.update = document.id(update);
this.setOptions(options);
this.makeRequest();
if (this.options.resetForm) {
    this.request.addEvent('success', function(){
        $try(function(){ this.element.reset(); }.bind(this));
        if (window.OverText) OverText.update();
    }.bind(this));
}
this.attach();

},

I can change the onComplete function specified by overwriting it using addEvent. I can also change the target of the form, but the update property (where I want to inject my ajax response) will not change.

Example:

var formRequest1 = new Form.Request("form1","resultInject1");
formRequest1.send();
var formRequest2 = new Form.Request("form1","resultInject2");
formRequest2.send();

The 2nd send() will still use resultInject1 as the update target.

I am unsure of this is meant to do this, or if it is a bug. I might be missing a logical way on changing the update property of an existing Form.Request, but I can't find one.

I got around this issue, by extending the Form.Request class with a new initializer which did not use Occlude. This seems to work flawlessly.

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 »

Shared Ticket Bins

Pages