I have 2 tables:

db.define_table('category',
                Field('name', 'string'),
                ...
                format='%(name)s'
                )

db.define_table('idata',
                Field('description', 'string'),
                ...
                Field('category', db.category)
                )

I using auto-complete widget like below to auto-complete category name:

db.idata.category.widget = SQLFORM.widgets.autocomplete(
     request, db.category.name, id_field=db.category.id, limitby=(0,10),
min_length=0)

I am using SQLFORM.grid on idata to get user input.

The category in the grid is free text with auto-complete and if the
category doesn't already exists, I would like to insert category before
idata in a single form submission that comes from grid.

Currently it will say "value not in database", until user added category
via separate form.

Tried to search around but didn't anything in this context.

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

Reply via email to