Im trying to create a formstyle, when the form is submitted without
introducing any value it skips any kind of validation and, without being
accepted, tries to perform db changes. Eventually i get an error ticket
like:
pymysql.err.InternalError'> (1048, u"Column 'salida' cannot be null")
This is the style:
def formstyle_stardom(form, fields):
parent = CAT()
for fieldname in form.fields:
field = form.table[fieldname]
if field.type != "id":
parent += LABEL(fieldname, _for=fieldname) + INPUT(_name=
fieldname, value=field.default)
parent += INPUT(_type="submit")
return parent
response.formstyle = formstyle_stardom
at the controller:
form = SQLFORM(db.reservas).process()
at the view:
{{=form}}
Nothing special,
im not using "for id, label, control, help in fields:" since i would like
to build the controls, but if i use the parameter "form" to create custom
markup, the form will skip validation. When i use the "fields" parameter
the form behaves correctly.
The question is, if the form is passed as a parameter in the form style why
cant we use it to create the style? Am i missing something?
Thanks.
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
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/d/optout.