Closed (won't fix)
Project:
MaxLength
Version:
7.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
15 Nov 2011 at 08:03 UTC
Updated:
26 Aug 2021 at 17:17 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
schnitzel commentedSorry I don't get it. You can define the limit per field in the field-settings of the field? so what else you want to change?
Comment #2
SilviaT commentedI think that what mrfelton mean is that you can't set a maxlength for a custom field. I'm using the last dev versionof the module and if I create a custom text field I don't see where I could set the "The maximum length of the field in characters". The countdown is performed only on the "Maximum length" set when the field has been created.
Comment #3
lovegame commentedHello, Well you can do some modify in module to make it work like how you configure node title maxlength.
Open maxlength.module and go to line 126 find code:
and replace it with this code:
next go and find the function
i test it and its working fine, i dont know how to make patch, so hope this will help
Comment #4
drupa11y commentedThe Code above works for the "maxlength_7.x-3.0-beta1" (patched module attached) but NOT for the latest DEV !!! Can someone update this code?
Comment #5
pakmanlhThanks for effors, the solution of #3 comment works fine for me.
I made a patch including these proposed changes.
Best regards
Comment #6
e0ipsoComment #7
Raumfisch commented#5 didnt work for me, not for the actual dev and neither for beta-1, so i made a new patch for 7.x-3.0-beta1 from the changes mori posted in #4
Comment #8
Raumfisch commentedI had another problem with the patched maxlength module from #7: If there are field_collections in the form containing the same fields like the host entity, the maxlength value of the field_collection is overridden by the setting made from the host entity.
To avoid this i added a few lines of code and made a new patch:
EDIT: Ohps, I just found out that patches should always be posted against the latest development version of the module... I will see if I can make it to update and post it the next days.
Comment #9
wuinfo - bill wu commentedBefore I find this thread. I have done a patch for 7.x-3.0-beta1. It did the job in a different way. I thought it is better to keep the check box and allow user to switch on and off the function.
Not allowed to set length larger than the default field maximum length. (This is to avoid possible database error).
User case: Field max length size is set too large at the beginning. Customer require to reduce the length allowed for some fields.
I should upload more later if we found bugs.
Comment #10
wuinfo - bill wu commentedSome warn when you apply the patch: "new blank line at EOF. "
Comment #11
wuinfo - bill wu commented#10 issue tag is a mistake.
Comment #12
pakmanlhThe issue was opened for version 7.x-3.x-dev, if patch in #5 don't apply on 7.x-3.0-beta1 is not a mistake, feel free to make new versions but realize this.
Thanks
Comment #13
alex.bukach commentedHere's patch #8 reworked for latest 7.x-3.x-dev. It works for me.
Comment #14
acrollet commentedre-roll
Comment #15
mepushpendra commentedHere is the patch for maxlengh version "7.x-3.0-beta1" which worked for me.
Comment #16
mepushpendra commentedUpdated patch for for maxlengh version "7.x-3.0-beta1".
Comment #17
robbertnl commentedMistake
Comment #18
robbertnl commentedNew patch for for maxlengh version "7.x-3.0-dev".
This is a quick rewrite, it works but might not be the best solution.
Comment #19
joelpittet@robbertnl could you explain the approach compared to #16?
Yours looks quite simple in comparison but there are minor coding standard issues with the else needing a linebreak and a space after the if's starting curly brace.
Comment #20
robbertnl commentedNew patch, according coding standards.
The new approach is a simplified version. Not all changes where necessary anymore with the newer commit.
I dont have time to dive into this, but i hoped this changed patch might help others.
Comment #21
joelpittetMore curious why #16 didn't do the trick for you/what prompted the rewrite?
Coding standard changes on pieces that are not changing make it a bit hard to review so we usually avoid them on hunks of the code that are not being changed. And interdiffs go long to help show the differences from others work if you can provide them. @see https://drupal.org/documentation/git/interdiff
Thanks for the coding standard fixes regardless.
Comment #22
robbertnl commentedI wasn't able to apply patch #16. The patch doesn't work anymore with the latest version. Some code of the patch already exist in the newest version of the module
Comment #23
joelpittet@robbertnl I see now, sorry that patch looks just that they created it from the wrong location or without --relative in an existing project it seems. The path says a/modules/contrib/maxlength/maxlength.module instead of a/maxlength.module so it may have been created in the sites/all directory.
So it no longer needs to pass around or check the bundle value as it did in 16? I checked to make sure that bit wasn't in 7.x-3.x branch.
Comment #24
kopeboyUpdates?
This would be really useful when used with the title_field (Title module), because you get automatically replaced title field, which is shared across all content types and with a preset max char of 255 which you cannot change otherwise.
Comment #25
transformative commentedI too was trying to use these patches to get Maxlength to work with my Title field (using the Title module).
The patch in #18 got maxlength to work with my Title field (and I assume that #20 would as well).
However, I also noticed another issue, "Override length validation for textfields", with a RBTC patch, which seemed similar to me. I tried it, and it also got maxlength to work with my Title field.
The trouble with both, of them, for me, was that they set a hard limit on the number of characters allowed (similar to how I assume "Force text truncate" is supposed to work). For now, I went back to the module I'd been using before, Soft Length Limit, to achieve what I wanted for the Title field, although I'd rather use Maxlength for everything in the long term.
Mainly, I wanted to point out the similarity between the two issues, as well as the other module, as they could potentially be combined (although one might be broader than the other, or I may not have fully understood their different purposes).
Thanks for the module, and all the work on patches!
Comment #26
philsward commented#20 Works beautifully against 7.x-3.2.
Personally, the styling is a bit over the top for my taste but otherwise it looks good.
Comment #27
daniel korte#20 wasn't working for me. The maxlength settings were being applied to field collections that it shouldn't be applied to. I re-added the missing bundle code from #16 and everything appears to be working again.
Comment #28
cedeweyWe are putting a feature freeze on the Drupal 7 version of the module, so I'm marking this Closed, won't fix. Thanks to everyone who worked on this issue. If anyone does want to maintain the Drupal 7 version, do reach out. We'd be happy to bring you on board as a maintainer.