Forum: Ruby on Rails RE: How do you make in_place_edit fields appear when empty?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Nathan L. (Guest)
on 2006-05-12 00:22
(Received via mailing list)
Well, since I got a clamoring response to this question, I thought I
would post what I did back to the list.  Maybe my hair-brained answer
will evoke some better solutions ;-)

The jist of it is that I query the contents of each field, and when
empty put in a default value (my choice was a "?").  That shows the user
that a value is needed and alows in_place_edit to show the field.

In the order view, with shipping point as the example field...

<% if @order.shippingpoint.empty? %>
    <%= @order.shippingpoint = "?" %>
<% end %>
<%= in_place_editor_field :order, :shippingpoint %>

I would really like to see something that doesn't involve custom code
for each field or putting garbage data in the field as a default value.
I am no Javascript expert (obviously).  Maybe there is a nice solution
using Javascript helpers, etc.?

Bryan Buecking (Guest)
on 2006-06-27 08:23
(Received via mailing list)
near the bottom there's a section called:
     "Small extension to editor to add a text in case field is empty."
This topic is locked and can not be replied to.