In-Place-Editing Blank Fields

Rails’s in_place_editor_field method is a nice wrapper around Scriptaculous’s inPlaceEditor, except for empty fields. These show up as nothings with, if you’re lucky, a box around it. If you can find the inside of the box and click in it, then you can enter text; otherwise, you’re screwed.

It took me a bit to figure this out, even though it’s plainly documented, so here’s the workaround: externalControl. Check it:

<p><span id="name-ext">Name:</span>
<%= in_place_editor_field :user, :name, {},
                     :external_control => 'name-ext' %></p>

With this the user can click on ‘Name:’ to edit the blank field.



  1. chad
    Posted July 27, 2006 at 4:00 pm | Permalink

    Thanks. You might want to add that the id will be styled with “display: none;” when clicked.

  2. bealach
    Posted July 29, 2006 at 10:42 am | Permalink


    Thanks for that – it was a great help.

    I do have a question though. How would I go about adding your magic to all empty fields without explicitly naming each empty field? I ask because the same set of fields will not always be null in the database.

  3. bealach
    Posted July 29, 2006 at 11:35 am | Permalink

    Sorry to keep writing here,but my last question was a bit silly (sorry about that too :) I figured out what to do.


  4. Posted August 10, 2007 at 9:00 am | Permalink

    Its a bit more tricky with a list

  5. sasha_gud
    Posted September 28, 2007 at 7:01 pm | Permalink


  6. Posted November 26, 2007 at 5:48 am | Permalink

    Thanks for this, was just pondering this myself.
    Regarding the list, if using a partial or plain loop, then the span id needs to have the id of the current row or some unique identifier.
    …span id=”m-…
    …:external_control => “m-#{}”)…

  7. Roshan
    Posted May 11, 2011 at 7:35 am | Permalink

    Thank you very much

%d bloggers like this: