bootstrap-flask icon indicating copy to clipboard operation
bootstrap-flask copied to clipboard

no label for radio buttons in form of type 'inline'

Open bbbart opened this issue 1 year ago • 1 comments

When you render a form with form_type="inline" the form labels get the class visually-hidden assigned to them.

I was wondering what the rationale behind this is? Is this a best practice of some sort?

Perhaps I'm not using the form_type correctly. What I'm looking for is a way to have my radio buttons rendered horizontally.

bbbart avatar Jul 27 '22 20:07 bbbart

Can you provide more details on this issue? For example, the template, Bootstrap version, the screenshot of the current render result, and your expected result.

If the label for the radio button is missing, it seems to be a bug.

For ref: https://getbootstrap.com/docs/5.0/forms/layout/#inline-forms

greyli avatar Jul 30 '22 07:07 greyli

I just tested this locally, and the rendering result of the inlineRadioField is correct.

image

If you want to make the radio buttons rendered horizontally, you may need to manually write the Bootstrap code.

greyli avatar Aug 20 '22 09:08 greyli

Hi!

So sorry for my late reply and thank you for following this one up.

I'm a bit confused now, as I was referring to

https://github.com/helloflask/bootstrap-flask/blob/5d013090f3f941cb18bddb6fa222c1279f923244/flask_bootstrap/templates/bootstrap5/form.html#L83-L88

where one can see that inline RadioFields explicitly get a visually hidden label, no?

You are right that manually writing HTML instead of relying on the provided macros is a way out here.

bbbart avatar Aug 22 '22 16:08 bbbart

The code should be correct, when the form type is inline, the radio field label should be hidden, and only the item labels were displayed.

https://getbootstrap.com/docs/5.0/forms/layout/#inline-forms

You may want to set the form type to horizontal.

greyli avatar Aug 23 '22 01:08 greyli

Yes, I also believe the code is according to the bootstrap documentation. I think I need to figure out the rationale behind that, then.

Thank you for your efforts!

bbbart avatar Sep 07 '22 08:09 bbbart