Hi.... I m a newbie working on web2py,and i want to create an SQLForm with database Employee.The fields of db.Employee are name,campus,timzezone .I want the user to input in the SQLform ,but the last filed of timezone shud be such that when the user inputs in the field ,it shud present a dropdown of fields from another database called 'timezone_countries'.The user shud be able to select from the dropdown and submit the form .The code i have written in DB,Default,and view are here respectively:- DB.py db.define_table('Employee',Field('name'),Field('campus'),Field('timezone'))
db.define_table('timezone_countries',Field('countries')) def timezone_countries_data(): result = {} result['countries'] = 'Brazil/Rio' db.timezone_countries.insert(**result) db.commit() DEFAULT.py def timezone_countries_dataF(): timezone_countries_data() def emp_input(): form=SQLFORM(db.Employee) return locals() def emp_selector(): if not request.vars.emp_timezone: ----------------------------------------------------------------------------------->where emp_timezone is the id of timezone in SQLFORM return ' ' pattern = request.vars.emp_timezone.capitalize() + '%' selected = [row.countries for row in db(db.timezone_countries.countries.like(pattern)).select()] return ''.join([DIV(k, _onclick="jQuery('#emp_timezone').val('%s')" % k, _onmouseover="this.style.backgroundColor='yellow'", _onmouseout="this.style.backgroundColor='white'" ).xml() for k in selected]) View: {{extend 'layout.html'}} {{=form}} <style> #suggestions { position: relative; } .suggestions { background: white; border: solid 1px #55A6C8; } .suggestions DIV { padding: 2px 4px 2px 4px; } </style> <div style="position: absolute;" id="suggestions" class="suggestions"></div> <script> jQuery("#emp_timezone").keyup(function(){ ajax('emp_selector', ['emp_timezone'], 'suggestions')}); </script> Kindly help....... -- --- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.