Can somebody please direct me to a good reference for the "rails" way to do forms? I notice that some inputs have square brackets in their names and some use underscores and I''m a little confused. On a related note, I wanted to create a text field that saved its value when the form was reloaded. I figured I could use this: <%= text_field "user", "username", { :size => 30, :value => @params[''user''][''username''] } %> But the rendered output was: <input id="user_username" name="user[username]" size="30" size="30" type="text" value="" value="posted value" /> Since the value attribute got duplicated, the posted value wasn''t displayed. Any ideas? Thanks, Carl
Carl Youngblood wrote:> On a related note, I wanted to create a text field that saved its > value when the form was reloaded. I figured I could use this: > > <%= text_field "user", "username", { :size => 30, :value => > @params[''user''][''username''] } %> > > But the rendered output was: > > <input id="user_username" name="user[username]" size="30" size="30" > type="text" value="" value="posted value" /> > > Since the value attribute got duplicated, the posted value wasn''t > displayed. Any ideas?Hi Carl, Try this: <%= text_field "user", "username", { :size => 30 } %> Rails will take care of filling the value when reloading. Rgds Dema