I think because

Field('id', requires = IS_IN_SET(ids),

id in the form is a string and ids in the set are integers.

On Dec 22, 1:19 pm, villas <[email protected]> wrote:
> form.accepts is a filter that moves request.vars into form.vars after
> parsing and also populates form.errors.
>
> Looking at form.errors should help.
>
> On Dec 22, 6:58 pm, Johann Spies <[email protected]> wrote:
>
> > I have the following controller:
> > =======================
> > def show_fpipl01():
> >        tabel = request.vars.tabel
> >        tb = tabel.lower()
> >        if auth.user_id in [21,22]: # Johann Spies (22) or ERA (21)
> >               rdata = db((db.service_provider.id == db[tb].service_provider)
> >                          ).select(db[tb].id,
> >                                   db.service_provider.name,
> >                                   db[tb].date,db.fpipl01.trainer,
> >                                   db[tb].focus)
>
> >        else:
> >               rdata = db((db[tb].created_by==auth.user_id) &
> >                          (db.service_provider.id == db[tb].service_provider)
> >                          ).select(db[tb].id,
> >                                   db.service_provider.name,
> >                                   db[tb].date,db.fpipl01.trainer,
> >                                   db[tb].focus)
>
> >        ids = []
> >        for row in rdata:
> >               ids.append( row['fpipl01']['id'])
> >        data = SQLTABLE(rdata,
> >                        headers = {'fpipl01.id' : 'ID', '
> > service_provider.name' : 'Service Provider',
> >                                   'fpipl01.date': 'Date', 'fpipl01.trainer':
> > 'Trainer',
> >                                   'fpipl01.focus': 'Focus of training'},
> >                        truncate = 50
> >                        )
> >        form = SQLFORM.factory(Field('id', requires = IS_IN_SET(ids),
> >                                    label = "Which event (number)?")
> >                              )
> >        if form.accepts(request.vars, session):
> >               redirect(URL(r=request,
> > f='show_fpipl01_data',vars=dict(id=id)))
> >        else:
> >               response.flash= 'Form not accepted'
>
> >        return dict(data=data,tabel=tabel,form=form)
> > =================
>
> > form.accepts never suceeds so no redirection takes place although
> > request.vars show:
>
> > id:
> > 2
> > tabel:
> > FPIPL01
>
> > So how do I find out why form.accepts does not succeed?
>
> > Regards
> > Johann
>
> > --
> >  May grace and peace be yours in abundance through the full knowledge of God
> > and of Jesus our Lord!  His divine power has given us everything we need for
> > life and godliness through the full knowledge of the one who called us by
> > his own glory and excellence.
> >                                                     2 Pet. 1:2b,3a
>
>

Reply via email to