I'm having a strange problem with this form.  I've included the form
definition and instantiation, the relevant part of the controller, and
the template, below.

The problem is that it totally ignores the value of kw['sort_crit'].

It always uses 'date' as the default.

It must be some silly thing that I am overlooking, but I must be
looking right through it because it all looks right to me.



=============


class TimesheetSearchFormFields(widgets.WidgetsList):
    """
    Fields for timesheet search form
    """
    begin_date = CalendarDatePicker(label='Begin Date:',
                                    format='%m%d%y',
                                    attrs=dict(size=6, maxlength=6),
                                    not_empty=False,
                                    default="",
                                    showOthers=True,

validator=MyValidators.validDate(format='%m%d%y'))

    end_date = CalendarDatePicker(label='End Date:',
                                  format='%m%d%y',
                                  attrs=dict(size=6, maxlength=6,),
                                  not_empty=False,
                                  default="",
                                  showOthers=True,

validator=MyValidators.validDate(format='%m%d%y'))

    filter_crit = TextField(default="",
                            label="Filter:",
                            attrs=dict(maxlength=50, size=13))

    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')])

    sort_reversed = CheckBox(label='Reversed?',
                             attrs=dict(default=True,

onchange='javascript:document.form.submit()'),
                             validator=validators.Bool())

search_form = TableForm(fields=TimesheetSearchFormFields(),
                        submit_text='Submit')
=============

        kw['sort_crit'] = 'id'
        print >>sys.stderr, kw
        return dict(form     = browse_form,
                    data     = timesheets,
                    title    = "Timesheets",
                    identity = identity,
                    add_url  = '/timesheet/add_edit?mode=add',
                    values   = kw,
                    search_form = search_form,
                    options=dict(),
                    attrs=dict(),
                    search_form_action = "/timesheet/browse"

=============

<!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>${getattr(self,'title','Forms Tutorial')}</title>
</head>
  <body>
    <div py:replace="main_menu()" />
    <hr/>
    <div id="nostripe" py:content="search_form(value=values)">filter
form</div>
    <hr/>
    <p><a style="text-decoration:none" href="${add_url}"><img
src="/tg_static/images/add.png" border="0"/>Add a record</a></p>
    <div py:content="form.display(data)">form</div>
  </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
-~----------~----~----~----~------~----~------~--~---

Reply via email to