File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Ajax.InPlaceEditor and manual enterEditMode

 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, the above solution I described works. Still wondering if there is a better way.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic