Closed (won't fix)
Project:
MaxLength
Version:
7.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
28 Feb 2012 at 02:56 UTC
Updated:
27 Jun 2023 at 19:02 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
malcomio commentedI've managed to get this working on the Drupal 6 version using a form_alter in a custom module.
By doing some debugging with CCK fields inside _maxlength_format_element I found the relevant values for $element['#max_length_properties'].
I used webform_email_this_page as my custom type, effectively to act as a namespace.
The field I was interested in had the field key message, so its ID was submitted-message.
I'm sure it would be possible to use this in D7 with a little adaptation.
If I had time, I'd try to patch the module to add an admin interface on webforms so this could be more generic.
mymodule.install:
mymodule.module
Comment #2
randallknutson commentedThe latest version of maxlength has been changed to where the sytax is different for webform elements. It is now:
Comment #3
Frederic wbase commentedOr you can always use http://drupal.org/project/webform_validation
grts
frederic
Comment #4
thekevinday commentedWebform validation is not really a solution here.
Directly supporting the maxlength is desirable if one wants the maxlength on the HTML markup itself.
The second issue is that a custom module may specifically not want to allow users, who can edit a webform, to be able to change/set this maxlength via something like webform validation.
Edit:
Webform validation provides validator hooks, so it only does part of what is needed.
The need for strict HTML maxlength settings on fields is not provided by Webform Validation as far as I can tell.
So there is still a need for this feature request.
While on the topic, are any of the other HTML markup attributes supported?
Standard HTML markup attributes, such as maxlength, need to be properly supported.
Comment #5
cmarcera commented+1 on Maxlength working on Webform Components in D7!
Comment #6
charliecheney commented+1 for Maxlength working on Webform Components in D7 from me as well. Thanks.
Comment #7
haleagar commentedOK I created a little module that provides an automatic integration bridge between MaxLength and Webform Validation.
It uses the settings from Webform Validation, so there is no administration aspect.
It's really just dependencies defined in .info and a form_alter that gets the settings from Webform Validation and sets the form component settings to trigger maxlength as indicated above by randallknutson.
I don't know if it would be something that would make it's way into MaxLength and Webform Validation since it's dependent on them both, perhaps as a optional sub module?
maxlength_webform.zip
Comment #8
mrrfakier commentedThanks haleagar. Had to tweak your module slightly to get it working using multistep webforms. Other than that it works great.
Comment #9
haleagar commentedwhat was needed? I'll be trying to update this as a patch.
Comment #10
totap commentedthx haleagar! #7 is working :)
Comment #11
ak55 commented#7 is working like a charm!
Thank you haleagar!
Comment #12
jay-dee-ess commentedRTBTC (right?)Comment #13
jay-dee-ess commentedApologies. Didn't realize this was a separate module.
Comment #14
TwoMice commented#7, Thanks for sharing that module! I've made some improvements, namely adding support for nested webform elements (ie., within fieldsets, etc.). The code is available here: https://github.com/twomice/maxlength_webform
Comment #15
jtjones23 commentedThank you TwoMice. Just what I needed this morning.
Comment #16
landsman commentedThis is can be cool for Drupal 8 too!
Comment #17
aubjr_drupal commentedUploading a copy of the module from #14 just in case that Github repo (or its container account) goes away and nobody around here has a fork.
Comment #18
aubjr_drupal commentedZIP file attached
Comment #19
larynThanks, all -- especially @haleager and @TwoMice. And FYI I have included the maxlength_webform functionality directly in the Webform Validation module for Backdrop, and I've submitted a patch for the Drupal 7 version of Webform Validation as well.
Comment #20
cedeweyWe are putting a feature freeze on the Drupal 7 version of the module, so I'm marking this Closed, won't fix.
Comment #21
ceeez0 commented#2 worked for me thanks!