Default Values ββfor WFForms RadioField
I create an html form with wtforms as follows:
<div class="control-group"> {% for subfield in form.time_offset %} <label class="radio"> {{ subfield }} {{ subfield.label }} </label> {% endfor %} </div> My form class is as follows:
class SN4639(Form): time_offset = RadioField(u'Label', choices=[ ('2', u'Check when Daylight saving has begun, UTC+02:00'), ('1', u'Check when Daylight saving has stopped, UTC+01:00')], default=2, validators=[Required()]) When I open the editing form now, I get the value 1 or 2 through SQL - how can I program the radio specification?
If I understand your question correctly, you want to have a form visualized with a pre-selected selection (instead of returning the default selection if not submitted to the form) ...
What you can do is build the form by setting a pre-selected value:
myform = SN4639(time_offset='2') And then pass myform to your template to be displayed.