I use WTForms and have a radio field like that:
class SimpleForm(Form):
radio_choice = RadioField('Label', choices=[('ip', 'IP'), ('ifname','Ifname')], default = 'ip')
In my html, I use jinja2 syntax:
{{ render_field(form.radio_choice) }}
{{ form.radio_choice.data }}
{% if form.radio_choice.data == ip %}
{{ render_field(form.weight) }}
{% else %}
{{ render_field(form.domain) }}
{% endif %}
How can I can get form.radio_choice.data
on html, I wanna render domain field when form.radio_choice.data == ifname
but I can only catch the value like that:
@app.route('/',methods=['post','get'])
def hello_world():
form = SimpleForm()
if form.validate_on_submit():
print form.radio_choice.data