- Issue created by @Schoenef
- π©πͺGermany Schoenef Unna
Urks, this appears to be really deeply in the core already. It is aparently possible to either override the Drupal.Ajax.prototype.beforeSend ( https://www.drupal.org/forum/support/module-development-and-code-questio... β ) or potentially to do it for a specific call only: https://drupal.stackexchange.com/questions/1890/how-to-add-some-javascri...
This should not be done generally but only for webform ajax.
- πΊπΈUnited States jrockowitz Brooklyn, NY
Using the built-in modal support via the below code and see attached. Modals with clientside validation are working as expected.
<a href="/form/contact" class="webform-dialog webform-dialog-normal button">Test Normal</a>
There are some issues with the latest version of the clientside validation module.
@see π Cientside validation errors revert to being output as a label in webform wizard pages with ajax enabled Active
@see π Once is not well implemented FixedWhat version of the clientside validation module are you using? 3.x or 4.x
- π©πͺGermany Schoenef Unna
Dear @jrockowitz,
it looks like my webform knowledge has a lot of holes... (It's the first time I hear of the
Webform Clientside Validation module or build in modal support).Incidentally it is not even activated in my project, so I'll try it out tomorrow and if it works. This whole ticket might be not an issue at all...
Thx for answering never the less!
- πΊπΈUnited States jrockowitz Brooklyn, NY
- π©πͺGermany Schoenef Unna
Dear @jrockowitz,
so I used your example yml form and enabled the webform client side validation module. It does work for your example (which has not ajax enabled) on the webform page, but I was not able to get it as model using
<a href="/form/contact" class="webform-dialog webform-dialog-normal button">Test Normal</a>
Any other module I'm missing.
However - if I enable ajax, the client side validation is ignored again (please see the updated yaml of your form - I had to rename it to kontakt thou)
So I think it really is a bug, ajax should not prevent the client side validation in my opinion. Ideally also it would not be necessary to install any extra plugin for the basic html5 client side form validation api to kick in.
- π©πͺGermany Schoenef Unna
Ok, I just found the "Enable Side Wide Modal Support" checkbox - thx a lot for the helpful videos.
however, this is exactly the same behaviour (ajax dissabled this time) - the form in the modal is turned automatically into some ajax thing - if I submit it empty, the validation is happening only server side, not client side.
Am I missing something else?
- πΊπΈUnited States jrockowitz Brooklyn, NY
Could you let me know if you are using a custom theme? What happens with Bartik or Olivero?
Is anything being logged in the browser's JS console?
Did you enable the webform_clientside_validation.module?
- π©πͺGermany Schoenef Unna
I'm using a custom theme indeed - I just switched to Olivero, but the behaviour is also the same:
I have Webform Clientside Validation, Clientside Validation jQuery and Clientside Validation modules enabled. The console shows no errors, it only logs the Ajax POST request on submit (Brave Browser).
- πΊπΈUnited States jrockowitz Brooklyn, NY
Maybe try updating to Webform 6.2.x?
- πΊπΈUnited States jrockowitz Brooklyn, NY
BTW, you should inspect the FORM and make sure there is no "novalidate' attribute on the FORM tag.
- Status changed to Closed: cannot reproduce
over 1 year ago 12:42am 26 May 2023 - π²πΎMalaysia akmalfikri
I can reproduce this issue.
Steps :
Requirements
1. Client side validation module & jquery
2. Webform client side validation submodule1. Create a webform
2. Add the webform link via dialog in any page
3. Click the button
4. Click submitErrors will be displayed in messages, not inline.
For reference : https://youtu.be/KClbJAXly7I
- Status changed to Active
about 1 year ago 1:59pm 27 October 2023 - π¨π¦Canada Liam Morland Ontario, CA π¨π¦
Does this happen on the latest development version of 6.2.x?
- πΊπ¦Ukraine r_cheh
Yes, I have the same issue, form has attribute novalidate="novalidate", and inline validation not working
- Status changed to Closed: cannot reproduce
8 months ago 10:33pm 8 April 2024 - πΊπΈUnited States jrockowitz Brooklyn, NY
I can't replicate this issue. If a theme or patch adds the
novalidate
attribute to theform
tag, clientside validation will not work as expected. - Status changed to Active
6 months ago 1:02am 7 June 2024 - π¦πΊAustralia mstrelan
This is fairly simple to reproduce.
- Install Drupal 10.3 with standard profile
- Install Webform 6.2.x and enable Webform and Webform UI
- Enable ajax on the default contact form at /admin/structure/webform/manage/contact/settings
- View the form at /form/contact and notice there is no
novalidate
attribute - Submit the form without populating any fields and notice the ajax validation
- πΊπΈUnited States jrockowitz Brooklyn, NY
For #18, I do not see any reasonable fix because the submit callback is being triggered via a click event, which doesn't trigger validation.
@see https://git.drupalcode.org/project/webform/-/blob/6.2.x/src/Form/Webform...
The best workaround is to use https://www.drupal.org/project/clientside_validation β