Denes,

> OK but you should check if minmax is not empty first.

I thought this wouldn't be necessary since the input comes from an
auto-complete or drop-box, and these contain values that are in the
zipcoderegions table for sure.

However, that's my logic, now that you mention checking if minmax is
not empty, I recall from my Java programming modules, never to take
these things for granted and always check.


In Python will this do:

form=form_factory()
if form.accepts(request.vars,session):
    minmax=db(db.postcoderegio.regio==request.vars.postcoderegio).\
    select(db.postcoderegio.codemin,db.postcoderegio.codemax)
        if not len(minmax):
            redirect:(URL(r=request,f='byzipcode'))
        else:
            minimum=int(minmax[0].codemin)
            maximum=int(minmax[0].codemax)
            clubs=db().select()
    elif form.errors:
      response.flash='form has errors'
    else:
      response.flash='please fill the form'
      clubs=[]
    return dict(form=form,clubs=clubs)


Or is there an other way to test id minmax is empty?


Kind regards,

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 web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to