Value for text_field_tag?

Hi!

I have this in my controller:
@text = params[:data][:text]

In the view, I have this code:
<%= label_tag(‘data[text]’, "Word/phrase: ") %>

<%= text_field_tag( ‘data[text]’, @text, :size => 40, :maxlength =>
254 ) %>

What I would like to have is to get a default value for the form
field. I cannot figure out why @text controller instance variable
doesn’t work. It’s a non-empty string, but the corresponding form
field is always blank. :frowning:

However, this piece of code always works,
<%= text_field_tag( ‘data[text]’, ‘STATIC STRING’, :size =>
40, :maxlength => 254 ) %>

What am I missing here? :-/

Tuo

El Lunes, 21 de Diciembre de 2009, T_P
escribió:> What I would like to have is to get a default value for the form

field. I cannot figure out why @text controller instance variable
doesn’t work. It’s a non-empty string, but the corresponding form
field is always blank. :frowning:

However, this piece of code always works,
<%= text_field_tag( ‘data[text]’, ‘STATIC STRING’, :size =>
40, :maxlength => 254 ) %>

What am I missing here? :-/

Please, ask in a list of RubyOnRails.