storborg / pyramid_uniform

Form handling for Pyramid

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Checkbox state is rendered incorrectly

storborg opened this issue · comments

The pattern used for data persistence across form submission attempts doesn't really work for checkboxes. Specifically, checkboxes will always be set to the default value passed into the renderer.checkbox() call, regardless of their state in the form.

One way to mitigate this would be to look for any evidence that the form was submitted (e.g. the request method is POST, or other keys are set in the form data) and use that to determine whether or not to use the supplied default value.