On Wed, 6 Feb 2013, Glen wrote: > Set the parameter to what you want selected: > > param(name => 'audi');
I've discovered that there are some parameter names when that is not true. I think this might be a case of reserved words in the stash. % param status => 'enabled'; %= select_field status => [['DISABLED' => 'disabled'], ['ENABLED' => 'enabled']] does not render <select name="status1"><option value="disabled">DISABLED</option><option selected value="enabled">ENABLED</option></select> as expected, but rather as: <select name="status"><option value="disabled">DISABLED</option><option value="enabled">ENABLED</option></select> Changing the field name to something other than 'status' (or 'text', 'json', 'inline', etc) makes it behave as expect.. The full list of reserved stash values is listed here: http://mojolicious.org/perldoc/Mojolicious/Controller#stash This is a real trap for the unwary. Should ->param() warn about use of reserved words? > > > On Feb 6, 2013, at 11:29 AM, Charlie Brady <[email protected]> > wrote: > > > > > Documentation for the tag helpers is "by example only", and doesn't define > > valid syntax. > > > > http://mojolicio.us/perldoc/Mojolicious/Plugin/TagHelpers#select_field > > > > How do I set the boolean "selected", viz: > > > > <select> > > <option value="volvo">Volvo</option> > > <option value="saab">Saab</option> > > <option value="vw">VW</option> > > <option value="audi" selected>Audi</option> > > </select> > > > > -- > > You received this message because you are subscribed to the Google Groups > > "Mojolicious" group. > > To unsubscribe from this group and stop receiving emails from it, send an > > email to [email protected]. > > To post to this group, send email to [email protected]. > > Visit this group at http://groups.google.com/group/mojolicious?hl=en. > > For more options, visit https://groups.google.com/groups/opt_out. > > > > > >
