for example

def index():
     return dict(form = 
SQLFORM(Field('a',requires=IS_IN_SET(('one','two'))),Field('b',required=IS_IN_SET([]))))

def options():
     cases = {'one':['x','y','z'], 'two':['w','e','r']}
     return response.json(cases[request.vars.a])

and in JS

jQuery('[name=a]').change(function(){jQuery.getJSON('options',function(data){jQuery('[name=b]').html(''.join(data.map(function(item){return
 
'<option>'+item+'</item>';}));})});

if I balanced the brackets right. ;-)






On Thursday, 27 November 2014 18:04:28 UTC-6, tahnoon pasha wrote:
>
> Hi, 
>
> I saw a discussion begin on this subject on Stackoverflow but can't find 
> the continuation here. 
>
> I have a case where I need to use the input in one form field (eg 
> portfolio) to filter options of  the IS_IN_SET constraint for a subsequent 
> form field (eg sector/industry). 
>
> I'm pretty new to web2py and jquery. How would I go about implementing 
> this? 
>
> Thanks

-- 
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/d/optout.

Reply via email to