In case anybody wants to know, I encoded \n to <br> in the database,
then when I send it back to the browser from the server, there are no
\n characters.  Then upon displaying it in the textarea, I convert all
the <br> to \n.  It seems to work well doing it like this.

On Apr 7, 9:41 am, David Beckwith <[EMAIL PROTECTED]> wrote:
> Did anybody experience this problem?
>
> In Firefox using Ajax.inPlaceEditor, after saving, the innerHTML of
> the target div is not updating when you have multiple lines of input
> (rows >= 2) and there is a newline character in the text content.  It
> works fine if you don't have a "\n" in the text content.  It just says
> "Saving . . . . " and doesn't update.
>
> I'm passing { rows: 2 } in as an option to Ajax.inPlaceEditor, and
> updating my div with $('box_text').update('here is some text');
>
> Is there a more robust way to update the value in the <div>
> innerHTML ?  Thank you!
>
> The relevant code is pasted below:
>
> # XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
>
> The column is a text data type in the database.  (the column also
> happens to be called "text")
> I wrote a helper method called "ipe" to make these DRYer:
>
>     <div class="text" id="text_<%= @box.id %>"><%= ipe @box, :text,
> {:rows => 3} %></div>
>
> This is my helper method generating the call:
>
>   def ipe instance, property, options={}
>     class_name = instance.class.to_s.downcase # in lower case
>     path = instance.class.to_s.pluralize.downcase
>     dom_id = "#{class_name}_#{property}"
>     value = instance.send(property)
>     option_text = ""
>     option_text << "rows: #{options[:rows]}," if options[:rows]
>     return %(
> <div id='#{dom_id}'>#{value}</div>
>     <script type=\"text/javascript\">
>       new Ajax.InPlaceEditor($('#{dom_id}'), '/#{path}/' +
> #{instance.id}, {
>           #{option_text}
>           htmlResponse: false,
>                                         ajaxOptions: {method: 'put'},
>                             callback: function(form, value) {
>                                         return 'authenticity_token=' + 
> '#{form_authenticity_token}' +
> '&#{class_name}[#{property}]=' + escape(value) }
>                           });
>     </script>
>     ) # return
>
>   end # ipe
>
> Here is my rjs file:
>
> Box.content_columns.each do |c|
>   property = c.name
>   page << "$('box_#{property}').update('[EMAIL PROTECTED](property)}');" if
> params[:box][property.to_sym]
> end
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to