[TASK] Adding novalidate Attribute to Fluid Form ViewHelper 99/53299/7
authorPascal Langhals <noreply@example.com>
Wed, 21 Jun 2017 14:31:11 +0000 (16:31 +0200)
committerFrank Naegler <frank.naegler@typo3.org>
Fri, 18 Aug 2017 14:38:01 +0000 (16:38 +0200)
At the moment there is no possibility to disable the client side
validation for the fluid form tag.

Releases: master,8.7
Resolves: #81654
Change-Id: I8adbd51f0d50528e8a7d92fc4aeb2315aefafee7
Reviewed-on: https://review.typo3.org/53299
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Wolfgang Klinger <wolfgang@wazum.com>
Tested-by: Wolfgang Klinger <wolfgang@wazum.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Henning Liebe <h.liebe@neusta.de>
Tested-by: Henning Liebe <h.liebe@neusta.de>
Reviewed-by: Sascha Rademacher <sascha.rademacher+typo3@gmail.com>
Reviewed-by: Matthias Vogel <typo3@kanti.de>
Tested-by: Sascha Rademacher <sascha.rademacher+typo3@gmail.com>
Reviewed-by: Steffen Frese <steffenf14@gmail.com>
Tested-by: Steffen Frese <steffenf14@gmail.com>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
typo3/sysext/core/Documentation/Changelog/master/Feature-81654-AddingNovalidateAttributeToFluidFormViewHelper.rst [new file with mode: 0644]
typo3/sysext/fluid/Classes/ViewHelpers/FormViewHelper.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/FormViewHelperTest.php

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 (file)
index 0000000..6c9a33c
--- /dev/null
@@ -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
index d7ae76b..05de4f7 100644 (file)
@@ -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();
index 7bdebe8..e509e5b 100644 (file)
@@ -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();
     }