Thank you Massimo,
It works perfectly!

On Saturday, January 25, 2014 11:51:24 PM UTC+2, Massimo Di Pierro wrote:
>
> def do_proc():
>     form = SQLFORM.factory(
>         Field('your_data', requires=IS_EMPTY_OR(IS_IN_DB(db,db.udata.id
> ,'%(title)s'))),
>         Field('your_file', 'upload', requires=IS_NOT_EMPTY() if not 
> request.vars.your_data else None))
>     form.process()
>
> On Saturday, 25 January 2014 07:56:23 UTC-6, desta wrote:
>>
>> Hello, I am a complete beginner building my first web application with 
>> web2py.
>>
>> I have a form that displays a dropdown list and also has a file upload 
>> option. I want the user to do one of the two. Either choose an entry from 
>> the list or upload a file.
>> I cannot figure out a way to do it with validators. Any suggestions are 
>> welcome.
>>
>> Thank you,
>>
>> Here is the form:
>>
>> *controller:*
>>
>> def do_proc():
>>     form = SQLFORM.factory(
>>         Field('your_data', requires=IS_IN_DB(db,db.udata.id
>> ,'%(title)s')),
>>         Field('your_file', 'upload', requires=IS_NOT_EMPTY()))
>>     form.process()
>>
>>
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to