Hi all,
can someone explain to me how the options for helper text_field_tag
supposed to be written. I really tried a bunch of stuff without success.
For example I need a field with id “query”, so I write
<%= text_field_tag :query %>
which works fine.
But what if I want the field only 5 characters big? I tried among other
<%= text_field_tag :query , options=>{:size=5} %>
which doesnt work.
Any clues?
thanks,
Kleas
Actually I just found it. Its
<%= text_field_tag :query, nil, :size => 5 %>
strangely though if I take out “,nil” it errors.
<…>
But what if I want the field only 5 characters big? I tried among other
<%= text_field_tag :query , options=>{:size=5} %>
which doesnt work.
Any clues?
<%= text_field_tag :query, nil, :size => 5 %>
Regards,
Rimantas
http://rimantas.com/
<…>
<%= text_field_tag :query, nil, :size => 5 %>
There is nothing strange in that.
Syntax is text_field_tag(name, value = nil, options = {})
so it expects value as the second parameter. Until named parameters
are supported you cannot have third parameters without specifying
second .
Regards,
Rimantas
http://rimantas.com/