On Fri, Jan 15, 2010 at 3:20 PM, DenesL <denes1...@yahoo.ca> wrote:

> Hi Miguel,
>
> contact_set=dict([(contact.id,contact.name) for contact in contacts])
>
> and in your controller override your requires:
> db.task.contact_id.requires=IS_EMPTY_OR(IS_IN_SET
> (contact_set,zero=None))
>
> note that you can use SQLFORM too here:
> form=SQLFORM(db.task,fields=['contact_id',...])
>
> fields=[list_of_field_names_that_should_be_in_the_form]
>
> and form.accepts will validate using the above requires if it is set
> before creating the form in the controller.
>
> Denes
>

Txs Denes.
Exactly what I was looking for!
Miguel
--
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To post to this group, send email to web...@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