Maybe I''m just tired from lack of sleep, but I can''t for the life of me figure out what I did wrong. I''ll but one of you will spot it right off. My template is returning this generated HTML (this is just an excerpt): <p><b>Category:</b><br> <select name=''recipe[category_id]''> <option value=''1''>Snacks</option> <option value=''2'' selected>Beverages</option> </select> </p> When the page is displayed in the browser, the second option (Beverages) is supposed to be selected in the list, but its not -- the first item (Snacks) is always selected. I also tried it like this (because the scaffolding generates this type of output): <p><b>Category:</b><br> <select name=''recipe[category_id]''> <option value=''1''>Snacks</option> <option value=''2'' selected="selected">Beverages</option> </select> </p> This doesn''t work either. What am I doing wrong? Thanks, in advance, Curt
On Mon, Nov 15, 2004 at 10:35:19PM -0600, Curt Hibbs wrote:> <p><b>Category:</b><br> > <select name=''recipe[category_id]''> > <option value=''1''>Snacks</option> > <option value=''2'' selected="selected">Beverages</option> > </select> > </p>I''ve tested this approach, and this one works fine? -- Marten Veldthuis http://www.standardbehaviour.com -- Elegance is an indicator for quality http://epilog.standardbehaviour.com -- Open-source weblogging solution
On Tue, 16 Nov 2004 07:37:27 +0100, Marten Veldthuis <m.veldthuis-bhBtkFhEHeMTIWBel16Y73nhMCiq3JZZ@public.gmane.org> wrote:> On Mon, Nov 15, 2004 at 10:35:19PM -0600, Curt Hibbs wrote: > > <p><b>Category:</b><br> > > <select name=''recipe[category_id]''> > > <option value=''1''>Snacks</option> > > <option value=''2'' selected="selected">Beverages</option> > > </select> > > </p> > > I''ve tested this approach, and this one works fine?You are probably using an XHTML DOCTYPE. XHTML requires you to use ''selected="selected"'', ''checked="checked"'', etc. -- Regards, John Wilger ----------- Alice came to a fork in the road. "Which road do I take?" she asked. "Where do you want to go?" responded the Cheshire cat. "I don''t know," Alice answered. "Then," said the cat, "it doesn''t matter." - Lewis Carrol, Alice in Wonderland
John Wilger wrote:> > On Tue, 16 Nov 2004 07:37:27 +0100, Marten Veldthuis > <m.veldthuis-bhBtkFhEHeMTIWBel16Y73nhMCiq3JZZ@public.gmane.org> wrote: > > On Mon, Nov 15, 2004 at 10:35:19PM -0600, Curt Hibbs wrote: > > > <p><b>Category:</b><br> > > > <select name=''recipe[category_id]''> > > > <option value=''1''>Snacks</option> > > > <option value=''2'' selected="selected">Beverages</option> > > > </select> > > > </p> > > > > I''ve tested this approach, and this one works fine? > > You are probably using an XHTML DOCTYPE. XHTML requires you to use > ''selected="selected"'', ''checked="checked"'', etc.I think I must have run into a bug in Firefox. I shutdown my machine and went to bed. When I got up it worked! I guess I forgot one of the basic rules about computers: if things are behaving unexplicable strangely, reboot -- if the problem is still there, *then* worry about fixing it! :-) Curt
I''ve noticed a quirk in Firefox where if you change the behavior of a form like you were and do a normal reload it doesn''t seem to take effect. You have to do shift-reload or similar. -d. On Tue, 16 Nov 2004 10:40:09 -0600, Curt Hibbs <curt-fk6st7iWb8MAvxtiuMwx3w@public.gmane.org> wrote:> I think I must have run into a bug in Firefox. I shutdown my machine and > went to bed. When I got up it worked!
Dan Peterson wrote:> > I''ve noticed a quirk in Firefox where if you change the behavior of a > form like you were and do a normal reload it doesn''t seem to take > effect. You have to do shift-reload or similar.That could be it! I''ll remember to try this next time. Thanks, Curt