I have a hard time figuring out what you are trying to do because your
field names do not mean anything to me. I may have given and I may be
giving wrong suggestions as a result. It would help if you could
translate the field names. Anyway, try adding the last line:

db.adres.adressoort.requires=[IS_IN_DB(db,db.adressoort.id,'%(soort)
s',orderby=db.adressoort.id),IS_NOT_IN_DB(db
(db.adres.bedrijf==request.vars.bedrijf),db.adres.adressoort)]
tmp=SQLField
('adressoort',db.adressoort,requires=db.adres.adressoort.requires[0])
tmp._tablename=db.adres.adressoort._tablename
db.adres.adressoort.widget=lambda f,v: OptionsWidget.widget(tmp,v)
db.adres.adressoort.widget['requires']=db.adres.adressoort.requires

Assuming this fixes the problem. I agree this is ugly and un-
intuitive. I think we can simplify with a minor modificaiton in the
OptionsWidget. I will think about it.


On Jul 7, 1:23 am, annet <annet.verm...@gmail.com> wrote:
> Massimo,
>
> The validators now read like:
>
> db.adres.adressoort.requires=[IS_IN_DB(db,db.adressoort.id,'%(soort)
> s',orderby=db.adressoort.id),IS_NOT_IN_DB(db
> (db.adres.bedrijf==request.vars.bedrijf),db.adres.adressoort)]
> tmp=SQLField
> ('adressoort',db.adressoort,requires=db.adres.adressoort.requires[0])
> tmp._tablename=db.adres.adressoort._tablename
> db.adres.adressoort.widget=lambda f,v: OptionsWidget.widget(tmp,v)
>
> The problem is that it doesn't prevent me from entering the same sort
> of address for a company twice. Changing the order of the validator
> and the widget results in an error ticket as does removing the first
> part of the validator. How do I get this to work?
>
> 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