Re: [web2py] Re: validating an empty select

2010-01-15 Thread Miguel Lopes
On Fri, Jan 15, 2010 at 3:20 PM, DenesL 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

[web2py] Re: validating an empty select

2010-01-15 Thread DenesL
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',...]) fiel

Re: [web2py] Re: validating an empty select

2010-01-15 Thread Miguel Lopes
On Fri, Jan 15, 2010 at 2:00 PM, DenesL wrote: > > Does the error occur on the 'empty' option of the select?. > You are introducing a 0 index value which is invalid in the db > > Yes. You are right! But how can I have a select with an empty option. Please note the following extra info: The sele

[web2py] Re: validating an empty select

2010-01-15 Thread DenesL
Does the error occur on the 'empty' option of the select?. You are introducing a 0 index value which is invalid in the db On Jan 15, 7:47 am, Miguel Lopes wrote: > I have a select field on a form. It might be empty or take one related > value. > > I the model: > db.task.contact_id.requires=IS_I