Problem/Motivation
Exploring ways to improve wb-frmvld robustness.
Render novalidate on forms that use wb-frmvld so native/browser validation does not jump in first. Drupal issue history explicitly discusses using novalidate to disable HTML5 validation behavior, and Webform’s own issue queue notes that novalidate directly affects client-side validation behavior.
Steps to reproduce
TBD
Proposed resolution
diff --git a/modules/custom/wxt_ext/wxt_ext_webform/wxt_ext_webform.module b/modules/custom/wxt_ext/wxt_ext_webform/wxt_ext_webform.module
index 2fd1dc3..7570b03 100644
--- a/modules/custom/wxt_ext/wxt_ext_webform/wxt_ext_webform.module
+++ b/modules/custom/wxt_ext/wxt_ext_webform/wxt_ext_webform.module
@@ -164,6 +164,10 @@ function wxt_ext_webform_webform_submission_form_alter(array &$form, FormStateIn
$webform = $webform_submission->getWebform();
if ($webform->getThirdPartySetting('wxt_ext_webform', 'wet_inline_validation', FALSE)) {
+ if (empty($form['#attributes'])) {
+ $form['#attributes'] = [];
+ }
+ $form['#attributes']['novalidate'] = 'novalidate';
$form['#prefix'] = ($form['#prefix'] ?? '') . '<div class="wb-frmvld">';
$form['#suffix'] = '</div>' . ($form['#suffix'] ?? '');
Remaining tasks
TBD
User interface changes
TBD
API changes
TBD
Data model changes
TBD
Comments
Comment #2
joseph.olstadThis seems to do the trick.
Comment #3
joseph.olstadsecond part not needed.
Comment #4
joseph.olstadThis works well
Comment #5
joseph.olstadComment #6
smulvih2@joseph good call on this one, this is actually what the wet-boew examples use on their
<form>elements as well.Comment #8
smulvih2Tested and works as expected. Pushed to 6.3.x, will include in next release.