EasyAdminBundle icon indicating copy to clipboard operation
EasyAdminBundle copied to clipboard

HTML validation does not get disabled when disabling email type field

Open Dominik-Czulak opened this issue 4 years ago • 2 comments

Describe the bug The HTML validation of input type "email" seems to prohibit form submission if the value is invalid even when the field is disabled. Using EmailType::class in a custom form type or EmailField on the edit page and setting the field disabled prevents saving the entity (it doesn't matter whether directly in Controller with ->setDisabled() or in FormType with $resolver->setDefaults(['disabled' => true]).

I would expect the frontend validation to be disabled when submitting a disabled field, as it seems to be the case with other constraints for validation (e.g. if you add constraints in TextType, they are being skipped when the field is disabled and you can still submit the form)

To Reproduce Tested with versions from EasyAdmin 4.0.0 / 4.0.5 / 4.0.9 / 4.1.2:

  1. Take any entity with a string property and set it to invalid email (e.g.: "something@something@something")
  2. In an AdminCrudController access the property with yield EmailField::new('property')->setDisabled(true); (alternatively create a custom form type with an EmailType in it for the property)
  3. Go to the edit form of the entity and try to submit the form by saving.

On another note: disabled fields used to be gray, and now they are white. Seems like the hierarchy of a background style in .form-control might be off (But I'm not sure about this :smile: ).

Dominik-Czulak avatar May 02 '22 12:05 Dominik-Czulak

The design issue about disabled fields no longer shown faded in gray is important. I'll try to fix that soon.

About the other issue, please try to investigate why that happens and see if we can fix it too. Thanks!

javiereguiluz avatar May 17 '22 18:05 javiereguiluz

Fixed in #5274 and #5245.

javiereguiluz avatar Jul 16 '22 16:07 javiereguiluz