diff --git a/src/webapp.py b/src/webapp.py index 7ff84e2..9b99291 100644 --- a/src/webapp.py +++ b/src/webapp.py @@ -297,11 +297,18 @@ class ScriptFormWebApp(RequestHandler): params['options'] = field['options'] if field['type'] == 'checkbox': + # Set default value from field definition params['checked'] = False - if field['name'] in form_values and \ - form_values[field['name']] == 'on': + if 'checked' in field and field['checked']: params['checked'] = True + # Set value from submitted form if applicable + if field['name'] in form_values: + if form_values[field['name']] == 'on': + params['checked'] = True + else: + params['checked'] = False + h_input = fr_inst.r_field(field['type'], **params) return fr_inst.r_form_line(field['type'], field['title'],