Forum: Ruby on Rails Form_for text_area

Posted by karthik Satyanarayana (Guest)
on 2013-03-13 08:26
(Received via mailing list)
Hi all, Since I am new to ruby on rails. I'm stuck in some minor issue.
I am using form_for in my view.

In that I am using a text text. So, My question is, how to add a default
value to the text_area along with the row and col values.

Please help me out ASAP.
Posted by Dheeraj Kumar (Guest)
on 2013-03-13 08:35
(Received via mailing list)
For the default value, add it in the model. Maybe in an after_initialize 
callback.
For the row and col values, read the documentation. 
http://api.rubyonrails.org/?q=text_area


--
Dheeraj Kumar
Posted by "Crispin Schäffler" <crispinschaeffler@gmail.com> (Guest)
on 2013-03-13 10:36
(Received via mailing list)
Hey

If you want default values add them in your model. If you are talking 
about a placeholder in your view:

form_for() do |f|

f.text_area :name, :rows => 5, :placeholder => "Your Text here...."


AS you can see i set 5 rows for the text area AS default to display. And 
there is some placeholder text in it...

Hope this helps you.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.