On Wednesday, February 1, 2012 5:43:58 PM UTC-5, shartha wrote:
>
> Thanks for the responses. I could not implement the method Dr. Massimo 
> offered because I didn't know what to use instead of 'reference city' 
> in his method. I am sorry. I am a total beginner. 
>
> Also, I have 2 more questions. The first one is: How can I remove the 
> first item from the drop-down menu, as it is just a blank option.
>

IS_IN_DB(..., zero=None)

See the documentation for the IS_IN_SET and IS_IN_DB validators here: 
http://web2py.com/books/default/chapter/29/7#Validators

Second question is that how can I figure out which item is selected?
>

When the form is submitted, you have to handle the incoming post request. 
The value selected will be in request.vars.choose_city, which will end up 
in form.vars.choose_city when the form is processed. If you show some code 
and explain what you want to do, we can be more specific.
 

>
> Just to be clear, I used 
> form = SQLFORM.factory(Field('choose_city','reference cities')) 
>

I thought you said that didn't work and you used the other method. You 
might also try Field('choose_city', db.cities), though I'm not sure if the 
reference field type will work in SQLFORM.factory.

Anthony

Reply via email to