No need for all this -- you can still use the method I proposed, creating just a single form (and giving it an explicit name). As you build each form in the view, just include a hidden "id" field and set its value to row.id (no need to use the "hidden" argument to SQLFORM, as you will be adding the hidden fields explicitly in the view).
Anthony On Thursday, September 17, 2015 at 3:50:46 AM UTC-4, Alfonso Serra wrote: > > And this does work, which is very bad. > > def example2(): > > rows = db(db.agencias).select() > > #create as many forms as rows > forms = dict() > for row in rows: > forms[row.id] = SQLFORM(db.agencias, row.id).process() > > fields = forms.itervalues().next().fields > > if request.post_vars: > id = request.post_vars.id > if isinstance(id, list): id = id[-1] #get the id from the hidden > field, not the record > > form = forms[int(id)] #get the corresponding form > > if form.accepted: > print "all good" > elif form.errors: > print "not good" > else: > print "welcome" > > rows = db(db.agencias).select() > return locals() > > This is bad since you have to query the db twice, and create as many > SQLFORM instances as records, also bad. > > Smartgrid and grid doesnt look like they fit my needs, ill keep reading > about them but they expose several routes to edit a record when im trying > to update them in a single view. > > If i could use a dummy SQLFORM that passes a db.table validation of a > random incoming post would be enough. ill keep trying. 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 [email protected]. For more options, visit https://groups.google.com/d/optout.

