Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I need this module because I need to see the number of characters in the field, but I don't need to limit the length. I can specify maxlength as 99999 or something, but I would like to be able to just display the counter in the desired field. Thank you!
Comment | File | Size | Author |
---|---|---|---|
#5 | interdiff-2329441-2-5.txt | 1.05 KB | JeroenT |
#5 | unlimited_field_just_a-2329441-5.patch | 1.79 KB | JeroenT |
#2 | unlimited_field_just_a-2329441-2.patch | 1.79 KB | JeroenT |
Comments
Comment #1
DamienMcKennaThat would be useful for integration with e.g. Metatag (#1918738: Character count on fields via Maxlength integration (D7)).
Comment #2
JeroenTI created a simple initial patch for this. I added a new element to the form 'maxlength_js_limit'.
How to test? Add maxlength_js and maxlength_js_limit to your form element :
I add the 'maxlength_js_limit' as a data-attribute on the form element and in javascript, I check if this data-maxlength-js-limit attribute exists. When it exists, I set the enforce option to false.
What do you think? Any suggestions?
Comment #3
seanBSeems to work fine! +1
Comment #4
DamienMcKennaOne minuscule thing - the "if" statements should have a space after them for both files to match the Drupal coding standards.
Comment #5
JeroenTAdded the code styling updates.
Comment #6
JeroenTComment #7
weri CreditAttribution: weri at Previon Plus AG commentedThis is related to #1841028: Add field setting "Do not restrict maxlength on writing"
Comment #8
DamienMcKenna@weri: The link you provided was to this issue, did you mean to link to a different one?
Comment #9
weri CreditAttribution: weri at Previon Plus AG commentedThank you @DamienMcKenna for the hint!! I linked now the correct issue.
Comment #10
cedeweyWe are putting a feature freeze on the Drupal 7 version of the module, so I'm marking this Closed, won't fix. Thank you everyone for working on this issue. If you do want to maintain the Drupal 7 version, do reach out. We'd be happy to bring you on board as a maintainer.
Also, this is a feature that exists in the Drupal 8/9 version so I do encourage people to upgrade to Drupal 8/9 and enjoy this enhancement along with the many other benefits of the latest version of Drupal.