In the Backdrop version of Webform Validation I've wrapped in some code that provides a counter on the text field showing how many characters remain (if the Maxlength module is installed). If you are interested I'd be happy to provide a patch for Drupal 7, or you can basically pull as needed from here:

https://github.com/backdrop-contrib/webform_validation/commit/bf8a6bbc6c...

(Let me know if you would like a patch for the above.)

Comments

laryn created an issue. See original summary.

liam morland’s picture

It would be great to have that as a patch.

laryn’s picture

Assigned: Unassigned » laryn
Status: Active » Needs review
StatusFileSize
new5.02 KB
new218.16 KB
new185.54 KB

No problem -- patch attached. See what you think. I'm also attaching before and after screenshots. (Before: error appears after submission; After: countdown/validation happens live before submission).

This MaxLength integration is based on work by [Hal Eagar](https://www.drupal.org/node/1459650#comment-9011799), with enhancements from [Allen Shaw](https://github.com/twomice).

liam morland’s picture

Status: Needs review » Needs work

Thanks for the patch.

Please check coding standards. I think $maxlength_desc should be empty when maxlength is not installed. webform_validation_get_node_rules() always returns an array so the if ($rules) is not needed.

laryn’s picture

StatusFileSize
new4.85 KB

Thanks for reviewing! How does this look?

laryn’s picture

Status: Needs work » Needs review
liam morland’s picture

Thanks for the patch.

There are still coding standards issues. Please install code sniffer to check these.

laryn’s picture

StatusFileSize
new5.03 KB

Third time's the charm? (Thanks for holding my hand a bit... I'm learning!)

There are a few errors/warnings on Code Sniffer yet but they are unrelated to anything I've added, so I didn't change them here.

liam morland’s picture

Title: Maxlength - progressive enhancement » Support maxlength module in max_length validator

  • Liam Morland committed a3c495b on 7.x-1.x authored by laryn
    Issue #3093953 by laryn, Liam Morland: Support maxlength module in...
liam morland’s picture

Status: Needs review » Fixed

Thanks!

Status: Fixed » Closed (fixed)

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