Here's the rest of my code doing what I posted before... if form.process().accepted: id = db.patient.insert(**db.patient._filter_fields(form.vars)) form.vars.patient=id id = db.emergencycontacts.insert(**db.emergencycontacts._filter_fields(form.vars)) id = db.dependents.insert(**db.dependents._filter_fields(form.vars)) #form.vars.dependents=id # and get a list of all persons redirect(URL('manage_patients'))
style = STYLE(""".not_empty {color:#d00;}""") return dict(form=DIV(style,form)) On Thu, Jun 27, 2013 at 5:31 PM, António Ramos <ramstei...@gmail.com> wrote: > Using this suggestion , my submit button is inside the last fieldset. > How do i take it outside? > > > 2013/6/26 Tom Russell <t...@caregointl.com> > >> To group inside a field I do something like this with 3 different tables: >> >> form=SQLFORM.factory(db.patient, db.emergencycontacts, db.dependents) >> fs0=form[0][:26] #patient rows >> fs1=form[0][26:37] #emergency contacts >> fs2=form[0][37:41] #dependents >> fs3=form[0][-1] # submit row (last) >> >> form[0]=TABLE( >> FIELDSET(TAG.legend("Patient Info"),TABLE(fs0),_id="register0"), >> FIELDSET(TAG.legend("Emergency Contact >> Info"),TABLE(fs1),_id="register1"), >> FIELDSET(TAG.legend("Dependents"),TABLE(fs2),_id="register2"), >> TABLE(fs3)) >> >> >> HTH >> >> >> On Wed, Jun 26, 2013 at 11:58 AM, António Ramos <ramstei...@gmail.com>wrote: >> >>> 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 web2py+unsubscr...@googlegroups.com. >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >>> >>> >> >> -- >> >> --- >> 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/groups/opt_out. >> >> >> > > -- > > --- > 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/groups/opt_out. > > > -- --- 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/groups/opt_out.