• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Ajax.InPlaceEditor and manual enterEditMode

 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, the above solution I described works. Still wondering if there is a better way.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic