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?