Hi there,

Due to the javascript reason, i need to create a form using FORM and INPUT 
helper. I wonder how I can create a form using these helpers with field 
displaying a dropdown list for selection (of customer from quotation form)? 
Below is a simplified version, currently i created autocomplete to display 
a list of customer names matched the input text while user is typing. 
Thanks in advance!

db.define_table('customer',
                Field('customer_name', requires=[IS_NOT_EMPTY()]),
                format='%(customer_name)s')
db.define_table('quotation',
                Field('customer', 'reference customer'),
                Field('project_name', requires=IS_NOT_EMPTY()),
                Field('total', 'double', default=0),
                auth.signature)

quote_row = db.quotation(id)
quotation_form = FORM(
                'Quotation id:', INPUT(_type='number', _name='id', 
_value=quote_row.id, _id='quotation_id', _readonly='True', 
requires=IS_NOT_EMPTY()),BR(),

                #'Customer Name:', INPUT(_type='number', _name='customer', 
_value=quote_row.customer, _id='quotation_customer', requires=IS_IN_DB(db, 
'customer.id', '%(customer_name)s')),BR(),  DIV(_style="position: 
absolute;", _id="suggestions", _class="suggestions"), BR(),
                'Customer Name:', INPUT(_type='text', _name='customer', 
_value=db.customer(quote_row.customer).customer_name, 
_id='quotation_customer', requires=IS_IN_DB(db, 'customer.id', 
'%(customer_name)s')),BR(), DIV(_style="position: absolute;", 
_id="suggestions", _class="suggestions"), BR(),

                'Project Name:', INPUT(_type='text', _name='project_name', 
_value=quote_row.project_name, _id='quotation_project_name'),BR(),
                'Total:', INPUT(_type='number', _step='0.01', 
_name='total', _value=quote_row.total, _id='quotation_total', 
_readonly='True'),BR(),
                INPUT(_type='submit'))

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to