I want to have a form with a set of radio buttons, with each radio button controlling enablement of several other controls, and I want the other controls to be interspersed with the radio buttons. In short, I want something like this:
- Radio Button
- Check Box
- Radio Button
- Select List
- Radio Button
where each radio button enables the control immediately below it.
The problem is that Jinja2 wants to render the radio buttons as a group with nothing between them; there doesn't seem to be a clean way to reference the individual button elements.
How do I render the individual radio buttons in the Jinja2 code? I'm using WTForms 2.3.3 and Flask 2.0.1.
For reference, here's the FlaskForm:
def list_sellers():
c1 = aliased(Contact)
c2 = aliased(Contact)
return db.session.query(c2).
select_from(c1).join(c2, c2.id==c1.seller_id).
filter(c1.seller_id != None)
class ExportForm(FlaskForm):
filtered = BooleanField('Apply Filters')
sellers_filter = RadioField(
'Filter by Seller',
choices=[
('all', 'All Sellers'),
('select', 'Select Seller'),
('none', 'No Seller')
],
validators=[Optional()]
)
seller = QuerySelectField(
'Seller',
query_factory=list_sellers,
allow_blank=False,
validators=[Optional()],
render_kw={'class': 'form-select'},
)
submit = SubmitField('Download')