Problem/Motivation

The module doesn't fully pass to formkit the validation for text fields' length.

Additionally, when a regex is added, the validation is overridden because the regex logic creates a formkit "string" validation rather than array.

Proposed resolution

I attach here my proposed solution:

  • Length checks are added for TextField and TextAreaField
  • Regex validation is moved to a separate function, returns an array to be concatenated with previous validations.
  • Regex validation function also returns the validation message set in webform.
Command icon 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

oceansprite created an issue. See original summary.

oceansprite’s picture

Status: Active » Needs review
oceansprite’s picture

oceansprite’s picture

Issue summary: View changes
dieterholvoet’s picture

Status: Needs review » Needs work

Thanks for your contribution! I left some comments in the MR.

oceansprite’s picture

Thank you for checking it out so quickly!
But, I can't find your comments on the MR, are they already submitted?

(I am new to Drupal and contributing)

dieterholvoet’s picture

My bad, I still had to submit the review. Done now!

dieterholvoet’s picture

Title: Improvement of Text fields' validation » Add regex and length validation to all text-based elements
Status: Needs work » Needs review
dieterholvoet’s picture

Issue summary: View changes
oceansprite’s picture

Status: Needs review » Reviewed & tested by the community

Thank you for your commits and review!
Your changes looks good to me.

dieterholvoet’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.