On Dec 2, 2006, at 5:57 AM, Patrick Lewis wrote:
> > > Patrick Lewis wrote: >> widgets.SingleSelectField(name="installer", label="Installer:", >> options=[(0, "MSI"), (1, "EXE"), (2, "Custom")], default=2) >> >> Don't ask me where 'default' comes from, or why that works. If >> anyone >> could explain where the 'default' comes from, I would appreciate an >> explanation. > > Sorry for replying to myself, but that was a bit addled. I know that > 'default' is a base widget attribute. What I'm not so clear on is how > that default filters it's way down to selecting a specified field. I > see that _selected_verb is somehow involved, but I'm still not quite > sure how that gets picked in the widget itself. > > Pointers appreciated. Thanks. When a widget's value is None and the form is not being redisplayed (after validation fails) then the default value for the widget becomes it's value. In SelectionField.update_params _is_option_selected (http://tinyurl.com/ya8slk) is called to see which option is being selected so it can add the "selected" attribute to to the selected option tag. Hope it helps, Alberto --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/turbogears?hl=en -~----------~----~----~----~------~----~------~--~---

