Is it possible to use multiple forms with one submit button? I am using pyramid and deform

249 views Asked by At

I have created 2 colander schemas as these reflect my database structure. I want to present both forms on one page with one submit button instead of two so that when submit is pressed it will validate and return errors for both forms at the same time.

I have tried putting submit on only one of the form variables but when submit is pressed only that particular form is validated. Is there a way to have the 'submit' button separate from the deform form structure?


import colander

# create colander schemas 

class Person(colander.MappingSchema):
    name = colander.SchemaNode(colander.String())
    age = colander.SchemaNode(colander.Integer(),
                              validator=colander.Range(0, 200))

class People(colander.SequenceSchema):
    person = Person()

class Schema(colander.MappingSchema):
    people = People()


class Sample(colander.MappingSchema):
    sample_ID = colander.SchemaNode(colander.String())
    samplename = colander.SchemaNode(colander.Integer(),
                              validator=colander.Range(0, 200))


schema = Schema()
secondschema = Sample()

#create forms using deform

from deform import Form
myform = Form(schema, buttons=('submit',))
secondform = Form(secondschema, buttons=('submit'),)) ```
0

There are 0 answers