[web2py] IS_IN_SET syntax

2010-07-26 Thread sarsar
Hi all,
   Please  help me with the syntax of dropdown selection , because i'
ve read a lot of answers and sugestions,  AND the book , and i cant
find how to do this simple thing .

 
db.candidate.for_language.requires=IS_IN_SET(['english','french','german']),default='english'



using crud to update the form , i expect that there is no blanc at
selection and having english as default even if the user doesnot
choose any selection .
 I have read a lot of questions , a lot of sugestions , from a lot
of people , i think i checked inside the online book, but there is no
clear syntax explanation about this iam asking , specially about the
default value , even if the user does not make a choise .
 Please forgive me if it is something obvious .

Sarados


Re: [web2py] IS_IN_SET syntax

2010-07-26 Thread Thadeus Burgess
db.candidate.for_language.requires = IS_IN_SET(['english', 'french',
'german'], zero=None)

If you notice how web2py will put a blank option in the drop down? the
zero attribute of IS_IN_SET or IS_IN_DB will control the value of that
first dropdown option. To completely rid yourself of the bank option,
you set zero to null, making the first value of the dropdown the
default selected.

--
Thadeus





On Mon, Jul 26, 2010 at 3:36 PM, sarsar sarsara...@gmail.com wrote:
 Hi all,
   Please  help me with the syntax of dropdown selection , because i'
 ve read a lot of answers and sugestions,  AND the book , and i cant
 find how to do this simple thing .


 db.candidate.for_language.requires=IS_IN_SET(['english','french','german']),default='english'

 

 using crud to update the form , i expect that there is no blanc at
 selection and having english as default even if the user doesnot
 choose any selection .
     I have read a lot of questions , a lot of sugestions , from a lot
 of people , i think i checked inside the online book, but there is no
 clear syntax explanation about this iam asking , specially about the
 default value , even if the user does not make a choise .
     Please forgive me if it is something obvious .

 Sarados