0

I am using the Field validation module to validate a text field using the Length rule with a minimum length of 1.

screenshot

When the field is left empty, no validation error is shown.

screenshot

Setting the field as required is not the solution for this specific case, as it causes problems with a module I am using.

How can I avoid users don't enter a value for that field?

2
  • Ticking field as required is not the solution for this specific question. Could you expand on why? If you require the field to be at least one character, by definition it's a required field isn't it?
    – Clive
    Aug 17, 2021 at 15:33
  • @Clive It's for Commerce and it's sub modules, and one of the sub modules Commerce Product Options has Required setting bugged and doesn't work. I got Select List fields already working with Field Validation and now need to make it work with Text field. But ran some test on fresh install and looks like Length rule doesn't even work on regular content type Text fields. Aug 17, 2021 at 15:38

1 Answer 1

0

I resolved the issue using the Clientside validation module, which has a sub-module that adds client side validation support for the Field Validation module.

2
  • The Clientside Validation module doesn't change how the Field Validation module works. It just uses AJAX to validate form elements. I tested both the modules on simplytest.me, but the issue described on the question hasn't been resolved.
    – apaderno
    Aug 18, 2021 at 13:24
  • I can't reproduce then what resolved it. Aug 18, 2021 at 16:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.