0

I have a form with multiple radios. I need to display the radios in a certain way(separately with additional form elements) so I had to use radio form elements instead of one radios element.

The radios are required but I have an issue with delegating the error to the parent element. I switched off the error message for the radios themselves via the #error_no_message attribute. Now the form error is properly displayed for the parent element but the error message contains the label of the first radio element instead of the parent element. So for example if I have fieldset named "Manufacturer" and it contains radios with labels like "Audi", "Mercedes" or "BMW" and I won't select any radio the form error, after form submission, will say "Field Audi is required." instead of "Field Manufacturer is required".

So how can I delegate the form error to the parent(which is working) but with making the form error to be applied to the parent itself so the proper label is displayed?

1 Answer 1

0

I did what I could but in the end I had to create new form element that provided me with the proper structure. The important thing about it though is mostly that it has input so the form element can be properly delegated whereas before I used fieldset which has no input therefore it would not display error properly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.