Open worikgh opened 6 years ago
I guess one workaround would be to add $form->setAttribute('novalidate', true);
.
That might need to be part of the fix too - I don’t see how else we can solve this without removing the required
attribute from fields...
Wow that's great :D
Affected Version
Show version numbers by pasting the output of
composer info --direct
.$ ../composer.phar info --direct phpunit/phpunit 5.7.26 The PHP Unit Testing framework. silverstripe/recipe-cms 1.0.0 SilverStripe recipe for fully featured page and asset content editing silverstripe/recipe-plugin 1.0.0 Helper plugin to install SilverStripe recipes
Hovering gets me Framework 4.0.0 and CMS 4.0.0
Description
Setting the required fields validator, then turning off validation for a action does not work.
The apparent reason is that 'RequiredFields' is implemented by writing 'required="required" into the HTML attributes of the fields. Thus the exemption from validation never gets a chance.
So it is not possible to have required fields and have a cancel button.
The solution is to have a separate form for the cancel button. Very infradig! For visual issues, please include browser version and screenshots. Please read https://docs.silverstripe.org/en/contributing/issues_and_bugs/
Steps to Reproduce
Create a form whith required fields and a cancel button. Call validationExempt(true) on the cancel button. It will not work