In Place Select addon

For those of you who have used Flickr you are aware of how easy it is to change the titles of your photos. You simply click the text you want to edit, the web page does some fancy stuff to change the text to a form element, you change your text and hit okay. It couldn’t be easier. I find myself working on a project where that type of functionality would be perfect except it would be great if I could change the form element to a select box instead of a input box.

After some searching I found SubZane’s Ajax.inplaceselect which is an update to the class published for scriptaculous . This worked absolutely great. However, I really was hoping to include an onComplete event that would update some content on the page based on what a user selects. I attempted this with the built-in InPlaceEditor and it worked find, but for some reason not with the InPlaceSelect. I was able to find a way around this by modifying a small bit of the code.

Before:

onComplete: function() {
this.leaveEditMode();
//this.options.onComplete.bind(this)(transport, this.element);
}

After:

onComplete: function(transport) {
this.leaveEditMode();
this.options.onComplete.bind(this)(transport, this.element);
}

Now I am up and running. I am assuming this.options.onComplete.bind(this)(transport, this.element); was commented out for a reason so if anyone knows please pass it on. For the meantime this appeared to solve the problem.

Comments are closed.