Just drafting something but here is the problem
My context:
I have 3 tables
table form
table steps
table fields
A form can have many steps
a step can have many fields
This way i can have one form with 3 steps, each with some fields and
another form with 10 steps , each with some more fields.
i read these tables to create a form using factory.
i have 2 problems
*1 i need to mark the input fields with a "step" tag *
here is my code:
def my_string_widget(field, value,step):
return INPUT(_name=field.name,
_id="%s_%s" % (field._tablename, field.name),
_class=field.type,
_value='',
*_step=step,*
requires=field.requires)
def index():
cont=0
fields=[]
formid=db.form(request.args(0) or 1)
steps=formid.steps.select()
for step in steps:
print "step id-",step.id
for field in step.fields.select():
print "field...",field.step
fields.append(Field(field.nome,widget=lambda
field,value:my_string_widget(field,value,*step.id*)))
form=SQLFORM.factory(*fields)
print form
if form.process().accepted:
response.flash='a gravar registo'
return dict(nome=formid.nome,form=form)
The problem is:
It marks all fields with the same "step" value, the last value in *step.id,
why?*
*
*
*2 - sqlformfactory *
how do i group sqlformfactory fields inside a div?
i want to create a section for each step in the form to style with css
Best regards
António
--
---
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/groups/opt_out.