RE: How do you make in_place_edit fields appear when empty?

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 :wink:

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.?


near the bottom there’s a section called:
“Small extension to editor to add a text in case field is empty.”

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs