Problem/Motivation
When i try to save nodes, i get the JS error " Step attribute on input type time is not supported.". This prevents from saving my changes in some cases, especially on node types on which i have Gutenberg enabled.
Proposed resolution
I managed to fix this hacking the module's clientside_validation_jquery JS file this way:
$(this).validate({
rules: {
"created[0][value][time]": {step: false}
}
});So i was wondering is there a way to define custom rules for the validation?
Thanks for helping me out :)
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | client-side-validation-triggering-error-office-hours.gif | 292.66 KB | skyriter |
| #14 | Screenshot 2024-03-14 at 3.04.49 PM.png | 154.34 KB | skyriter |
| #13 | Screen Shot 2022-02-22 at 11.54.13 AM.png | 85.12 KB | jwilson3 |
| #12 | 3200530-jquery-validate-step-datetime-inputs.patch | 4.68 KB | jwilson3 |
| #9 | 3200530-9.patch | 757 bytes | khiminrm |
Issue fork clientside_validation-3200530
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
joey-santiago commentedComment #3
abaier commentedSame problem here. Just noticed the error in the console when filling out the time part of a date field.
Comment #4
joey-santiago commentedRight, i forgot to put here my fix.
i created a module with this JS in it.
Seems to work fine so far.
Comment #5
abaier commentedThanks! That brought me on track.
I got this working for all time fields being present on first page load. For new fields coming in after loading in a paragraphs type using ajax I did not achieve it yet. I still think this bug should be solved in the main module.
Comment #8
piggito commentedI created a MR based in #5 to provide this rules by default on module
Comment #9
khiminrm commentedCreated patch from MR in #7.
Comment #10
gnugetThis looks like a workaround to me, the
stepattribute in theinput[type=time]is indeed valid.Instead of removing the step attribute the plugin should allow to use it.
Comment #11
nikunjkotechaComment #12
jwilson3This issue boils down to a limitation in the jQuery validation library currently only supporting text, number and range inputs.
https://github.com/jquery-validation/jquery-validation/blob/master/src/c...
There is an open stale PR that was never properly reviewed by maintainers of jQuery validation probably due to the effort to test all the different date/time input types and the fact that there are no automated tests or even manual tests provided.
https://github.com/jquery-validation/jquery-validation/pull/2119
Amazingly the patch applies cleanly, with offsets to the "dist" version of the jquery.validate.js file, despite the diff being generated against the "src/core.js", if you just specify the dist file, it applies!
However the issue then becomes the minified version jquery.validate.min.js
Fortuitously, the Drupal module loads the unminified version when it is configured to NOT use the CDN.
So I've copied the diff file to my local patches/ folder in the repository and changed "src/core.js" to "dist/jquery.validate.js" and put it into composer and it worked.
So, as long as you're using the npm-asset method documented in the composer.example.json file provided with the clientside_validation module, you can add the following to the "extra" > "patches" section in composer.json and get it working.
Comment #13
jwilson3It appears that the PR approach on https://github.com/jquery-validation/jquery-validation/pull/2119 has some issues with Drupal node's date fields.
I'm unable to save the node due to client side validation errors on the min/max functionality that the PR adds for date fields. Something seems wrong with the MM/DD/YYYY format.
Note, this screenshot is using the Publication Date module, but I assume the same thing would happen with just native Drupal and the Authored on field.
Comment #14
skyriter commentedWe're seeing this error on our site, too. I wanted to understand the root cause, and it seems to be this module.
To verify that no custom code on our side was throwing this, I created a site on Simplytest.me with the following modules installed and enabled
- office_hours@1.17.0
- clientside_validation@4.0.2
- clientside_validation_jquery@4.0.2
I used the default configuration.

While entering the hour range, the site threw this error when going from the "From" to the "To" field.

Comment #15
jackfoust commentedStill seeing this in 2025, anyone come up with a useful workaround for it?
Comment #16
skyriter commented@jackfoust I posted a patch on issue 2949540 for allowing us to exclude forms by form id so that we could use the browser's built-in validation. That is our current work-around.