Hello there and happy holidays. I''m not sure if the surprise for what I''m seeing in my forms is justified, but I am very surprised, so here''s the thing. - I have a simple model with a single text field named ''content''. - I run the app and create a new record. - I write "one two three four" into the ''content'' textarea and save the record. The text is properly displayed by the "show" action. - Now I edit the same record (or create a new one, it doesn''t matter), this time entering one two three four i.e. newline-separated strings. As expected, the saved record is displayed inline as the previous one, if no extra processing (such as textile or markdown) is done on the output. - Now, edit the record, look at the textarea field, and here''s the weird thing (to me at least) one two three four I''m hoping that the post will retain the layout of what I''ve just typed, i.e. the text passed to the textarea through the model''s instance variable is split into four lines, with A BUNCH OF WHITESPACE BEFORE EACH LINE, except for the first. If I update the record without touching the textarea, this whitespace will be saved as well. Editing and updating again and again the record results in the three lines being moved further and further off to the right, with the size of the record growing accordingly, as shown through the console. Am I missing something quite obvious? So sorry to have bothered you all if I am. Cheers and thanks in advance, Giuseppe -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Dec 29, 2007, at 12:14 PM, Giuseppe Bertini wrote:> > Hello there and happy holidays. > > I''m not sure if the surprise for what I''m seeing in my forms is > justified, but I am very surprised, so here''s the thing. ><snip>> > Am I missing something quite obvious? > So sorry to have bothered you all if I am. > > Cheers and thanks in advance, > GiuseppeWill you please post the form code? Peace, Phillip --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> Will you please post the form code?Phillip, thanks for your response, it worked like a charm! Seriously, it got me thinking a little harder, like I should have in the first place, and I found out what the problem was. I am using HAML to produce views instead of ERb. I like it a lot because of its cleaniness, in terms of both source and output, but it does have a problem with <pre>, <code>, and <textarea> output, as detailed here: http://www.mail-archive.com/haml-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org/msg01593.html The code for my form was: #note %h1 Editing note = error_messages_for :note - form_for(@note) do |f| = f.text_field :title = f.text_area :content = submit_tag "Save" = link_to "Cancel", notes_path It seems to work properly after the following change: ~ f.text_area :content Thanks again and peace to you, Giuseppe -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---