>
> I have a  requirement , that when I post values of a crud form, that  
> values of some fields copied to another table.
>
> How can I add this action to the submit button or inside the procedure?
>

If you're using SQLFORM:

def myform:
    form = SQLFORM(db.mytable)
    if form.process().accepted:
        db.othertable.insert(field1=form.vars.field1, field2=form.vars.
field2, ...)
    return dict(form=form)

If you want to insert all the fields from the form that also exist in 
db.othertable, you could also do:

    db.othertable.insert(**db.othertable._filter_fields(form.vars))

Anthony
 

-- 



Reply via email to