Or you can do: OPTION(value_, _value=key_, _selected=key_ == selected)
That will result in selected="selected" when key_ == selected and no selected attribute in the HTML otherwise. Even easier, though, is to let the SELECT helper handle this for you by specifying it's "value" argument (which automatically sets the option with that value as selected): SELECT(get_drop_down_option9(options), value='dad') In that case, you can simplify get_drop_down_options9() so it doesn't set the "selected" attribute, as that will be done by the SELECT helper. Anthony On Monday, December 31, 2012 10:30:38 AM UTC-5, rochacbruno wrote: > > > > On Mon, Dec 31, 2012 at 1:21 PM, Teddy Nyambe > <[email protected]<javascript:> > > wrote: > >> def get_drop_down_option9(options_dict, selected): >> return [OPTION(value_, _value=key_ , **{'_selected': 'selected'} if >> selected == key_ else {}) for key_, value_ in options_dict.iteritems()] >> > > --

