From: "Iñaki Baz Castillo" Date: 2009-12-21T20:51:42+09:00 Subject: Re: Value for text_field_tag ? El Lunes, 21 de Diciembre de 2009, T_P escribió: > 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. :-( > > 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. -- Iñaki Baz Castillo