开发者

How can I add a title tag and change size option to a form field in rails?

开发者 https://www.devze.com 2023-01-29 07:17 出处:网络
The following ruby code in my view is like this: <%= f.t开发者_如何学Goext_field :email, :class => \'\' %>

The following ruby code in my view is like this:

<%= f.t开发者_如何学Goext_field :email, :class => '' %>

It renders like this:

<input class="" id="user_email" name="user[email]" size="30" type="text" />

I want to be able to change the size and add a title tag which would look like this:

<input class="" id="user_email" name="user[email]" size="40" title="Your Email" type="text" />


For size, do :size => 40

You could try the same for :title, but I've never seen it used.

<%= f.text_field :email, :class => '', :size => 40, :title => 'whatever' %>

Like I said, not sure if the title hash works.

0

精彩评论

暂无评论...
验证码 换一张
取 消