How to dynamically change variable name in form.vars.var_name
问题 I have defined counter variable in controller. I can define tables and fields dynamically. tables = [db.define_table('example_table_%s' % x, Field('example_field_%s' % x, type='string', ...) ... ) for x in range(0, counter+1)] I can add defined tables to SQLFORM. form = SQLFORM.factory( db.table_1, db.table_2, *tables, submit_button='Submit') I can control process manually if the counter value is '2'. if form.process.accepted(): id = db.table_1.insert(**db.table_1._filter_fields(form.vars))