How can I set default value for text_field?

Please this code:

<%= f.label :"Host Name" %>
<%= f.text_field :HostName %>

I want to set a default to this text field, how can I do this?

Zhao Yi wrote:

Please this code:

<%= f.label :"Host Name" %>
<%= f.text_field :HostName %>

I want to set a default to this text field, how can I do this?

Is this what you looking for?
<%= f.text_field :HostName, :value => “my default value” %>

Petan C. wrote:

Zhao Yi wrote:

Please this code:

<%= f.label :"Host Name" %>
<%= f.text_field :HostName %>

I want to set a default to this text field, how can I do this?

Is this what you looking for?
<%= f.text_field :HostName, :value => “my default value” %>

Yes, this is exactly what I am looking for.

thanks.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs