Skip to content
Advertisement

Symfony Form not showing correct error (pending on constellation)

I have an issue with the constrains-check of my form and the correct display of errors.

describtion of problem

The form has three checkboxes and two of them are mandatory to be checked by the user (accepting Terms and Conditions stuff).

  • if only one of the mandatory checkboxes (either the first or the secound) is not checked, the error is displayed correctly
  • if both mandatory checkboxes are not checked, no error is displayed at all

analysis already done

  • looping through errors link show that there is really no error
  • if i add an additional textfield to the form, the above problem disappears (but I don’t want that field).

BookingTermsAndConditionsFormType.php

JavaScript

_formTermsAndConditions.html.twig

JavaScript

Question

What is wrong here?

Advertisement

Answer

Please find here my workaround. I have added an additional field and used the HiddenType for it. This made the form-errors work correctly. Don’t ask me why…

BookingTermsAndConditionsFormType.php

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement