Justin Perkins wrote:
> This only happens when submitOnBlur is set to true and you are using a
> cancel button/link. Read on for background info and perhaps why you
> might not want to do that...
I'm pretty sure I was not using submitOnBlur and I was never talking about a
keylistener (unless it's built into IPE).
Here's the code I fixed the problem with:
Object.extend(Ajax.InPlaceEditor.prototype, {
handleFormSubmission: function(e) {
var form = this._form;
var value = $F(this._controls.editor);
this.prepareSubmission();
var params = this.options.callback(form, value) || '';
if (Object.isString(params))
params = params.toQueryParams();
params.editorId = this.element.id;
if (this.options.htmlResponse) {
var options = Object.extend({ evalScripts: true },
this.options.ajaxOptions);
Object.extend(options, {
parameters: params,
onComplete: this._boundWrapperHandler,
onFailure: this._boundFailureHandler
});
new Ajax.Updater({ success: this.element }, this.url, options);
} else {
this._savedUserEntry = value; // steve
var options = Object.extend({ method: 'get' }, this.options.ajaxOptions);
Object.extend(options, {
parameters: params,
onComplete: this._boundWrapperHandler,
onFailure: this._boundFailureHandler
});
new Ajax.Request(this.url, options);
}
if (e) Event.stop(e);
},
wrapUp: function(transport) {
this.leaveEditMode();
if ((this._savedUserEntry != null) && (!this.options.htmlResponse)){ //
steve
this.element.innerHTML = this._savedUserEntry; // steve
this._savedUserEntry = null;
} // steve
// Can't use triggerCallback due to backward compatibility: requires
// binding + direct element
this._boundComplete(transport, this.element);
}
});
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---