diff --git a/typo3/sysext/core/Documentation/Changelog/master/Feature-81654-AddingNovalidateAttributeToFluidFormViewHelper.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-81654-AddingNovalidateAttributeToFluidFormViewHelper.rst new file mode 100644 index 0000000000000000000000000000000000000000..6c9a33c1485215956487aef32bf55ca15eaef58a --- /dev/null +++ b/typo3/sysext/core/Documentation/Changelog/master/Feature-81654-AddingNovalidateAttributeToFluidFormViewHelper.rst @@ -0,0 +1,16 @@ +.. include:: ../../Includes.txt + +====================================================================== +Feature: #81654 - Adding novalidate Attribute to Fluid Form ViewHelper +====================================================================== + +See :issue:`81654` + +Description +=========== + +Adding novalidate attribute to fluid form viewHelper to disable the browser form validation. +The attribute novalidate is optional and can set with novalidate="1".The argument will +converted to <form novalidate="novalidate">...</form>. + +.. index:: Fluid diff --git a/typo3/sysext/fluid/Classes/ViewHelpers/FormViewHelper.php b/typo3/sysext/fluid/Classes/ViewHelpers/FormViewHelper.php index d7ae76b5f85b44dfb2ba050e15f1ce6625deb5fc..05de4f7bc3d186ce239b23e6f58ce47df064680b 100644 --- a/typo3/sysext/fluid/Classes/ViewHelpers/FormViewHelper.php +++ b/typo3/sysext/fluid/Classes/ViewHelpers/FormViewHelper.php @@ -128,6 +128,7 @@ class FormViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Form\AbstractFormViewH $this->registerTagAttribute('onreset', 'string', 'JavaScript: On reset of the form'); $this->registerTagAttribute('onsubmit', 'string', 'JavaScript: On submit of the form'); $this->registerTagAttribute('target', 'string', 'Target attribute of the form'); + $this->registerTagAttribute('novalidate', 'bool', 'Indicate that the form is not to be validated on submit.'); $this->registerUniversalTagAttributes(); } @@ -144,6 +145,11 @@ class FormViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Form\AbstractFormViewH } else { $this->tag->addAttribute('method', 'post'); } + + if ($this->arguments['novalidate'] === true) { + $this->tag->addAttribute('novalidate', 'novalidate'); + } + $this->addFormObjectNameToViewHelperVariableContainer(); $this->addFormObjectToViewHelperVariableContainer(); $this->addFieldNamePrefixToViewHelperVariableContainer(); diff --git a/typo3/sysext/fluid/Tests/Unit/ViewHelpers/FormViewHelperTest.php b/typo3/sysext/fluid/Tests/Unit/ViewHelpers/FormViewHelperTest.php index 7bdebe88dc458827e734a75dce7cf3db8e640810..e509e5b1ab0d5988d3f52feea159cb24f642d60e 100644 --- a/typo3/sysext/fluid/Tests/Unit/ViewHelpers/FormViewHelperTest.php +++ b/typo3/sysext/fluid/Tests/Unit/ViewHelpers/FormViewHelperTest.php @@ -54,6 +54,7 @@ class FormViewHelperTest extends ViewHelperBaseTestcase $viewHelper->expects($this->at(2))->method('registerTagAttribute')->with('name', 'string', $this->anything()); $viewHelper->expects($this->at(3))->method('registerTagAttribute')->with('onreset', 'string', $this->anything()); $viewHelper->expects($this->at(4))->method('registerTagAttribute')->with('onsubmit', 'string', $this->anything()); + $viewHelper->expects($this->at(6))->method('registerTagAttribute')->with('novalidate', 'bool', $this->anything()); $viewHelper->expects($this->once())->method('registerUniversalTagAttributes'); $viewHelper->initializeArguments(); }