Hello,
I wounder what should be the best way to alter a form generated by
SQLFORM.factory in a way where fields will be placed into a html table a 3
columns.
So each 3 fields I need to insert a "tr" and each field need to be in a
"td"...
It could be simpler to use FORM instead, but it seems easier until now to
use SQLFORM.factory since it manage all validators and I get generic
widget...
Here some code :
inputs_list = []
for a in field1_names_dict:
inputs_list.append("Field('"+field1_names_dict[a]['field1_name']+'_f1'+"',
type='boolean', widget=SQLFORM.widgets.checkboxes.widget,
requires=IS_EMPTY_OR(IS_IN_SET(['"+assay_names_dict[a]['field1_name_ui']+"'])))")
inputs_list.append("Field('"+field1_names_dict[a]['field1_name']+'_f2'+"',
db.ref_tab1, requires = IS_EMPTY_OR(IS_IN_DB(db,'ref_tab1.id
','%(REPRESENTFIELD)s')))")
inputs_list.append("Field('"+field1_names_dict[a]['field1_name']+'_f3'+"',
db.ref_tab2, requires = IS_EMPTY_OR(IS_IN_DB(db,'ref_tab2.id
','%(REPRESENTFIELD)s')))")
inputs_list.append("formstyle='divs'")
formstring = "SQLFORM.factory(" +','.join(inputs_list)+")"
form = eval(formstring)
# ALTERING the form...
Thanks for helping.
Just to mention, the form is not bind directly to a table I will parse the
output of the form to insert value in a linking table that contains other
fields information.
Richard