And here is a much simplified project that exhibits the behavior.
If I comment out @validate and @error_handler, it defaults to 'Order of
Entry'.
Otherwise, it stubbornly defaults to 'Date'.
===============
class TimesheetSearchFormFields(widgets.WidgetsList):
sort_crit = SingleSelectField(label='Sort by:',
attrs=dict(onchange='javascript:document.form.submit()'),
options=[('date', 'Date'),
('client.clientName',
'Client'),
('employee.lastName',
'Employee'),
('id', 'Order of Entry')],
validator=validators.String()
)
form = TableForm(fields=TimesheetSearchFormFields(),
submit_text='Submit')
class Root(controllers.RootController):
@expose(template="ssf.templates.welcome")
@validate(form=form)
@error_handler()
def browse(self,tg_errors=None, **kw):
return dict(form=form,
values=dict(sort_crit='id')
)
===============
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:py="http://purl.org/kid/ns#"
py:extends="'master.kid'">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"
py:replace="''"/>
<title>Welcome to TurboGears</title>
</head>
<body>
${form(action='browse', value=values)}
</body>
</html>
================
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---