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

joseph.olstad created an issue. See original summary.

joseph.olstad’s picture

Issue summary: View changes

This seems to do the trick.

joseph.olstad’s picture

Issue summary: View changes

second part not needed.

joseph.olstad’s picture

This works well

joseph.olstad’s picture

Assigned: Unassigned » smulvih2
Status: Active » Needs review
smulvih2’s picture

Status: Needs review » Reviewed & tested by the community

@joseph good call on this one, this is actually what the wet-boew examples use on their <form> elements as well.

  • smulvih2 committed f43be730 on 6.3.x
    Issue [#3578948] by joseph.olstad - Improvement - Render novalidate on...
smulvih2’s picture

Status: Reviewed & tested by the community » Fixed

Tested and works as expected. Pushed to 6.3.x, will include in next release.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.