h!

i got 2 tables, i need to make one update form for both, let's say they are:

---------
db.define_table("item",
    ...
    Field('keywords', 'list:string', ...)
    ...
)
db.define_table('concrete_item',
    Field('item_id', 'reference item'),
    ...
)
---------
In the controller:
---------
def edit():
    item = db.item(request.args(0))
    concrete_item = db.concrete_item(item_id=item.id)
    fields = []
    for f in item:
        fields.append(f)
    for f in concrete_item:
        fields.append(f)

    form = SQLFORM.factory(*fields)
    # put values to form fields
    for f in db.item:
       form.vas[f.name] = item[f.name]
    for f in db.concrete_item:
       form.vas[f.name] = item[f.name]

    if form.proccess().accepted:
        # here call update_record, etc.
        pass

    return dict(form=form)
---------

The problem is with the keywords field, when the form is rendered in the
view it don't show the current value for the field. Meanwhile if i just
make the update form for only one table:

--------
def edit()
    item = db.item(request.args(0))

    form = SQLFORM.factory(db.item, record=item)
    return dict(form=form)
--------

The keywords field show the current values. Can any1 help me with this ?

-- 
Yoel Benítez Fonseca
http://redevil.cubava.cu/
$ python -c "import this"

-- 
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