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

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
B287416096bb24ccaaedef43b0b1921b?d=identicon&s=25 Nathan Leach (Guest)
on 2006-05-11 22: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.?

Nathan
8ba9994aedcc364535faefca6f27f376?d=identicon&s=25 Bryan Buecking (Guest)
on 2006-06-27 06:23
(Received via mailing list)
See http://wiki.script.aculo.us/scriptaculous/show/Aja...
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.