posted 16 years ago
I am using Scriptaculous' Ajax.inPlaceEditor. I have a page where I upload a file and then I presented with 1+n images. Each image has a name but the name can be changed. Simple enough. I click on the name which is in a DIV and the inPlaceEditor takes over and all is well.
However, the client wants a Change link so the user understands better they can change something. I guess highlighting the text and having a tool tip that says "Click to Change" as well as changing the mouse cursor to a pointer isn't enough. :roll:
So, I know I can do something like:
var editor = new Ajax.InPlaceEditor('product_1',...);
editor.enterEditMode('click');
And if I only had one of these on a page it would be fine. But as it turns out I could have up to 50 maybe. So I need a way to clicking on the link and choosing the appropriate editor to turn on edit mode.
My first thought is as I create a new InPlaceEditor I can put it in an array with a key of the image ID or an index of some sort. When I click the change link I could look up that editor instance in the array and call the enterEditMode function on it. I am getting ready to try this but thought I would also see if anyone else has any other good suggestions.
Some things to consider. The piece of HTML that contains the InPlaceEditor code in coming back from an Ajax request. So my code looks something like:
[ May 01, 2007: Message edited by: Gregg Bolinger ]