It should be easy. Post your relevant model and controller code.

BTW it probably doesn't make any difference...  but maybe you might
consider using the notation account_id instead of accountID.  I read
somewhere that some databases have case sensitive fields and that
web2py makes some assumptions about this.  Just better to work all in
lowercase and avoid hitting that possible complication in the
future. :)

Regards,  D

On Feb 16, 6:47 pm, Oskari <oskari.pe...@gmail.com> wrote:
> I'm still struggling with the IS_IN_DB-validator. This problem occurs
> when trying to implement reference id for example via a controller
> line:
> request.vars.reftableid = 2
>
> The form just informs it isn't in the database. Why is that?
>
> On Feb 13, 3:14 pm, Oskari <oskari.pe...@gmail.com> wrote:
>
> > Uncommenting that did the trick. Perhaps there was something wrong
> > with that =)
>
> > Anyways, thanks!
>
> > On Feb 13, 3:17 am, villas <villa...@gmail.com> wrote:
>
> > > Try commenting out the line 'custom_auth_table.accountID.requires...'
> > > If that doesn't give you any progress, post all your auth model. I'm
> > > sure someone should be able to spot something  obvious -- these bugs
> > > can be right under our noses sometimes :)
> > > -D
>
> > > On Feb 12, 11:03 pm, Oskari <oskari.pe...@gmail.com> wrote:
>
> > > > Thank you for your answer villas!
>
> > > > I don't think that is the problem. I am able to make inserts through
> > > > the appadmin-site, but somehow it fails with form.accepts().
> > > > I also tried what you suggested, but could not quite get it working.
>
> > > > On Feb 12, 8:45 pm, villas <villa...@gmail.com> wrote:
>
> > > > > Not sure, but the 3rd attrib of 'IS_IN_DB' doesn't look right?
>
> > > > > Maybe if you tried something like this, e.g.
> > > > > custom_auth_table.accountID.requires = IS_IN_DB(db,db.accounts.id,'%
> > > > > (name)s')
>
> > > > > On Feb 12, 1:28 pm, Oskari <oskari.pe...@gmail.com> wrote:
>
> > > > > > Hi!
>
> > > > > > I'm having trouble making an insert with form.accepts()
>
> > > > > > Currently I have a custom auth_user that has one extra field:
> > > > > > Field('accountID', db.accounts) with
> > > > > > custom_auth_table.accountID.requires = 
> > > > > > IS_IN_DB(db,db.accounts.id,id)
>
> > > > > > While trying to modify variables it fails with "not found in db"
>
> > > > > > def func():
> > > > > >     form=SQLFORM(db.auth_user)
> > > > > >     request.vars.accountID = 1
> > > > > >     if form.accepts(request.vars,session):
> > > > > >         response.flash = "Succesfully created user"
> > > > > >     return dict(form=form)
>
> > > > > > Why does not form.accepts() recognize and accept my accountID?
>
>

Reply via email to