Denes and Alvaro,
Thanks for your replies.
The by place function now reads like:
def byplace():
response.functionname=T('Club locator op plaats')
response.image=URL(r=request,c='static',f='media/core/banner.png')
form=form_factory(SQLField('plaats',requires=IS_NOT_EMPTY(),\
widget=lambda self, value:INPUT
(_id='byplace',_name='plaats',_class='ac_input',_type='text',requires=self.requires)))
if form.accepts(request.vars,session):
clubs=db((db.bedrijf.id==db.adres.bedrijf)&
(db.bedrijf.id==db.bedrijfinschrijving.bedrijf)&\
(db.adres.plaats==request.vars.plaats)&
(db.adres.adressoort=='vestigingsadres')&
(db.bedrijfinschrijving.inschrijving=='fitnessclub'))\
.select
(db.bedrijf.id,db.bedrijf.bedrijfsnaam,db.bedrijf.status,\
db.adres.straat,orderby=db.bedrijf.status|
db.bedrijf.bedrijfsnaam)
elif form.errors:
response.flash='form has errors'
clubs=[]
else:
response.flash='please fill the form'
clubs=[]
return dict(form=form,clubs=clubs)
And does exactly what I want it to do under all circumstances. Two
more questions though:
When I remove clubs=[] an error ticket is issued telling me that clubs
is being used before being assigned a value. I haven't seen this:
elif form.errors:
response.flash='form has errors'
clubs=[]
in the web2py manual.
Furthermore, when I remove requires=IS_NOT_EMPTY() the functionality
breaks, so I need both IS_NOT_EMPTY and requires.self.requires, why?
Annet.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---