Hi
I am trying to validate a number field. I need the field to have a minimum of 9 digits and a maximum of 14 digits. I have tried both the Min Length/Max Length settings and tried using the reg expression [1-9][0-9]{9,14} in the Pattern field but neither are throwing up an error with Clientside Validation. If I turn off Clientside Validation the form displays the error using either method if the field does not validate.
Also, if I leave the field blank and have it marked as required, Clientside Validation is not displaying the Custom Required Error Message - it displays the default "Number is required' message.
Any idea?
F
Comments
Comment #2
frankdesign CreditAttribution: frankdesign commentedSorry
I should clarify, when I said Clientside Validation is not throwing up an error, I meant to say it's not displaying the error inline like all other validation errors. The error is displayed but as a standard error message at the top of the page.
F
Comment #3
sgohil1 CreditAttribution: sgohil1 commented@frankdesign - i know this is a year old post, but was wondering if you have found the solution?
I have the similar situation where i have Composite element with #pattern = [0-9], but it does not throw the error when the clientside_validation_jquery module is enabled. If i uninstall the module, it throws the default error (not displaying the message, but changing the textbox border to Red).
Thank you.
Comment #4
frankdesign CreditAttribution: frankdesign commented@sgohil1 - I gave up on Clientside Validation. The D8 version hasn't been updated in nearly 2 years and I couldn't find a solution to the issue. For the moment, I rely on Drupal's Inline Form Errors and browser HTML5 Validation. It's not the perfect solution, but it works.
F
Comment #5
sgohil1 CreditAttribution: sgohil1 commented@frankdesign - Thanks a lot for your quick response. I believe I'll either have to write a custom module or go with the route you went!
Comment #6
nikunjkotechaHi @frankdesign,
For the custom required message, it is done now in latest dev version. I was waiting for few core bugs to be fixed before releasing the new/stable version but it seems it is going to take a lot of time in core so I'll release a new version sometime next week.
For the regex error, I don't think there is anything supported in the module for now, we can for sure add support for it. I'll check next weekend once I'm back from vacation. I understand you are not using this now but in case you get a requirement again and use this, feel free to create custom plugins and contribute back :)
Thanks,
Nikunj
Comment #7
nikunjkotecha