I've found a solution. Thanks Yarko, for your suggestion.
I downloaded the source and used the shell interface
to explore the FORM object.
The new working code is:
def index():
import datetime
# form sets the default year to work on
if not session.bene_year:
session.bene_year = str(datetime.datetime.now().year)
form = FORM('Set Year: ',
INPUT(_name='year', _value=session.bene_year,
requires=IS_NOT_EMPTY()),
INPUT(_type='submit'))
# set the default year from the form
if FORM.accepts(form, request.post_vars, session,
formname='form_one'):
session.bene_year = request.post_vars.year
form.components[1].attributes['_value']=session.bene_year #
reset the default value of the INPUT field
# set the year
response.flash = 'The default year is now '+session.bene_year
# fetch the current beneficiaries for the default year
records = SQLTABLE(db
(db.beneficiary.year==session.bene_year).select(db.beneficiary.ALL),
truncate='1024')
return dict(form=form, records=records)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" 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/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---