This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Ajax.InPlaceEditor and manual enterEditMode Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Ajax.InPlaceEditor and manual enterEditMode" Watch "Ajax.InPlaceEditor and manual enterEditMode" New topic

Ajax.InPlaceEditor and manual enterEditMode

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299

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',...);

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 ]

GenRocket - Experts at Building Test Data
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299

Ok, the above solution I described works. Still wondering if there is a better way.
I agree. Here's the link:
subject: Ajax.InPlaceEditor and manual enterEditMode
Similar Threads
Is there something better then event.pageX/Y?
Need help with Jquery
Can you post data from textfields to a URL without having a <form>
Undefined Array Problem
What is Ajax.InPlaceEditor typical usage ?