2009/7/30 Fabian <[email protected]>: > As I posted earlier, I want to count lines in a text area. > I use the following function > lines = texto.split(/\n/).size if texto !=nil > > But fails when one line of text "wraps" automatically to the next line so no > "\n" mark is returned into the text. > > So i found the "wrap" attribute of textareas that works this way: > > soft > hard > off > > Soft forces the words to wrap once inside the text area but when the form is > submitted, the words will no longer appear as such (Line breaks will not be > added). > > Hard wraps the words inside the text box and places line breaks at the end > of each line so that when the form is submitted it appears exactly as it > does in the text box. > > Off sets a textarea to ignore all wrapping and places the text into one > ongoing line. > > So I insert it in my txtarea definition like this: > > <%= f.text_area :texto, :cols => "30" , :style => "whiteSpace:pre-line;", > :wrap => "hard" %> > > > Nothig happens. The count line was the same. > Any suggestions ?
Have you checked the html generated (View, Page Source or similar in browser) to check the option has been coded correctly? Colin --~--~---------~--~----~------------~-------~--~----~ 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 [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-talk?hl=en -~----------~----~----~----~------~----~------~--~---

