hello one and all,

ok, so I have the basic code:

    btn = [INPUT(_type='submit', _name='submit', _value='Add 1-Step')]
    btn.append(INPUT(_type='submit', _name='summary', _value='Add 1-Step 
then Summary'))
    frm = SQLFORM.factory(db.case, db.sheet, buttons=btn)

which is great for merging fields from both tables into one form when 
creating brand new records.  but can I pass id's to SQLFORM.factory to 
signal to it that I want to edit existing records instead of only insert. 
 something like:

    if (request.args(0) is not None):
        cid = request.args(0)
    else:
        cid = None
    if (request.args(1) is not None):
        sid = request.args(1)
    else:
        sid = None
    frm = SQLFORM.factory(db.case, db.sheet, buttons=btn, db.case.id=cid, 
db.sheet.id=sid)

or something to that effect.

so if both cid and sid are None then factory will create both new, as 
before.  if cid is not None and perhaps sid is also not None, then factory 
will automatically fill in the values from those particular records and 
leave hidden inputs for the case.id and sheet.id signaling back to 
process().accept that the 
db.case.update(**db.case._filter_fields(from.vars)) will update the proper 
record when it returns from being edited.

or if factory doesn't inherently fill the fields if the record exists, then 
we have to do a whole bunch through old-fashioned code?

just looking for advice, thanx in advance, lucas 

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