I have a simple piece of code:
form = SQLFORM.factory(Field("readonly_field", writable=False, default="can't
change")
,Field("some_field", requires=IS_LENGTH(10,5))
,Field("some_flag", "boolean", writable=False,
default=True))
if form.process().accepted:
print("accepted")
return dict(form=form)
Note that the "some_flag" field is defaulted to "true". If the form is
submitted successfully, everything happens as expected: the "some_field" is
blank but the other two fields have their original defaulted values.
Now, if the form fails validation, the "some_flag" checkbox is unchecked.
The other read-only field still has its value.
It should also be noted that using the "keepvalues" flag in the "process"
function will persist the value in "some_field", but has no effect on
whether the "some_flag" checkbox is checked.
This looks like a bug, but if I'm doing something wrong I'm open to
alternatives.
--
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.