Problem/Motivation
It appears that due to #3084798 in the clientside_validation module, that custom:
other__required_error: 'Some error'
properties aren't working with clientside validation anymore. I believe that this may be related to #states not being used to hide / show the other option in these element types.
Steps to reproduce
- Enable webform 6.x, clientside_validation 3.x, and webform_clientside_validation.
- Add a radios-other and checkboxes-other element to a webform.
- Configure a custom required error message for each element.
- Select 'other' for each and submit the form.
- Observe that the validation message for both elements is "This field is required" and not the custom message.
Proposed resolution
TBD
Remaining tasks
TBD
User interface changes
TBD
API changes
TBD
Data model changes
TBD
Thanks!
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | 3217704-13.patch | 5.18 KB | jrockowitz |
| #10 | 3217704-9.patch | 5.24 KB | jrockowitz |
| #8 | 3217704-8.patch | 6.33 KB | jrockowitz |
| #5 | 3217704-custom-other-error-messages-5.patch | 5.98 KB | luke.leber |
| #2 | webform.webform._3217704_custom_other_error_mess.yml | 5.04 KB | paulocs |
Issue fork webform-3217704
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
paulocsHere is a webform example to replicate the issue.
I see if I provide a patch later.
Comment #3
jrockowitz commentedLet's also fix this issue in 8.x-5.x. I think something like the below JS solution as a Drupal.behavior could go in modules/webform_clientside_validation/js/webform_clientside_validation.ife.js
Comment #4
luke.leberThe problem seems to also affect
select_otherelement types.Attaching fail-patch to prove there is a problem (let's hope the D.O. test bot agrees!).
I had to:
inline_form_errorsmodule to ensure that the javascript is loaded on the test page.Another unrelated point of interest:
I don't think that this line runs any assertions.
waitForTextseems to just returnFALSEif the text isn't found.I forgot to ask, are patches or issue forks preferred for the Webform module at this time?
*after-run edit...
It looks like the test runner pulls in the 8.x-1.x branch for clientside_validation even though the composer.json file clearly states ~3.0 in the
require-devsection...so I'm not sure what's going on.https://dispatcher.drupalci.org/job/drupal8_contrib_patches/71928/console
May have to ask in the infrastructure / testing channel to figure out why this is.
Comment #5
luke.leberUploading patch that should fix the test that was broken in #4.
Comment #6
paulocsWorking on it...
Comment #7
paulocsPatch looks good! It has test coverage and it fixes the problem properly.
Comment #8
jrockowitz commentedAttached is minor cleanup of the patch.
I am not sure we can assume that the inline_form_error.module is enabled with clientside validation. Maybe via backend code, we set the correct attribute.
Comment #10
jrockowitz commentedAttached is what I hope is a simpler fix that does not rely on the JS or the inline_form_errors.module. BTW, Having the test coverage and an example helped a lot.
Comment #11
luke.leberI really like the approach in #10. This even covers users (like us) whose custom clientside validation integration work predates the
webform_clientside_validationmodule.It seems to work perfectly with our custom integration as well as with the stock webform modules.
+1 RTBC from me!
Comment #12
luke.leberActually, one small nitpick. There seems to be a duplicated comment in the test.
Comment #13
jrockowitz commentedComment #14
luke.leber#13 looks perfect to me.
Comment #15
jrockowitz commented