Closed (works as designed)
Project:
MaxLength
Version:
7.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
28 Jan 2015 at 15:13 UTC
Updated:
26 Aug 2021 at 18:34 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
mschudders commentedI can confirm this.
However it is working on the Title field of a content type but not on text areas on the content type.
Tried with Ckeditor 3.6.6.2 & 4.5.3 & just plain text.
Tried with a single text area, and with field collections containing text areas.
Comment #2
jagadmarx commentedMaxlength doesn't work for me too even using plain text fields and text area. Is there a fix for this?
Comment #3
flbr commentedI too have this problem. I don't see maxlenght.js included anywhere. I included it manually, but it didn't fix it.
Comment #4
bhavikshah9 commentedI have faced same problem as mentioned by @flbr.
I have activated module, flushed cache and tried. But, not working.
I have tried with plain text, textarea and along with CKeditor. But, it didn't worked in any case.
I have checked source code and found that maxlength.js in not included in code.
Comment #5
adiatisSame problem here on a flat textarea without editor. Can I check something?
Comment #6
ncameron commentedBy default the count does not show for UID 1 / admin. Try logging in as a regular user.
Comment #7
nicrodgersThis caught me out at first, too. The Administrator role (not just UID 1) has the permission 'bypass max length' assigned by default, so you don't see it whilst logged in as admin. I think we should either update the documentation to state this, or preferably, change the default behaviour so that no roles are automatically assigned the bypass permission. What does everyone else think?
Comment #8
campsjos commentedI lost all the day because of this...
This should be on the documentation :(
Comment #9
bdombro commentedThis doesn't seem to be disabled, either. +1 that it should not be default, and should definitely be in the documentation.
Comment #10
nicrodgersI have updated the documentation to explain the default permission setup/behavior.
https://www.drupal.org/node/1303664
Comment #11
nicrodgersUploading a patch to the README.txt to explain that the default configuration means Administrators wont see the counter.
Comment #12
nicrodgersComment #13
dkre commented+1 disabled by default.
I'm not sure of the use case where you want to input a longer value than the users you're building for.
Great module though :)
Comment #14
khumbu commentedJust came across this and don't get it either...what is/was the thought behind this? I would also disable this by default...it will help a lot of people (like me).
Comment #15
dqdWell, this issue could possibly come up even if your admin permissions are set up correctly ...
Comment #16
samtny commentedMy two cents is that the field should still show the configured 'max length', but explicate a bit, e.g.;
"The max length for this field has been configured to allow 310 characters, however your permissions allow you bypass this limit..."
Comment #17
dgtlmoon commentedI found that even with 'bypass maxlength' permission DISABLED for "Administrator" role it was still allowing the administrator to bypass the role (because user_access will always say that UID 1 has access to everything)
I added a small function to factor this and included the original README.txt patch which will be incorrect without the extra tweak to access functionality
Comment #18
kopeboyI can confirm that after setting the permission to bypass off I still can't see the counter on fields as admin..
Comment #19
zmove commented+1 for that patch to be commited, its very annoying when you make a website, to not see what you are setting up about maxlength.
Comment #20
quotientix commented+1 for changing the default setting or even better displaying a message for the superuser.
Comment #21
kumkum29 commented+1
User 1 should see the counter.
Comment #22
youngwolf0 commented+1 to seeing this as an administrator, just lost a couple of hours to this thinking I was doing something wrong.
Comment #23
caspervoogt commentedpatch from #17 fixes this. I had noticed the admin role was set by default to bypass maxlength restrictions... but that was not working and maxlength was not happening. I then removed that permission from the admin role, and nada. This patch solved it. +RTBC
Comment #24
daskausikdas commentedIn my case maxlength is considering the html text though I checked 'Truncate html' option. Is there any patch to solve this problem?
Comment #25
daskausikdas commentedI have used ckeditor..
Comment #26
jimafisk commented#17 patch worked for me, thank you dgtlmoon!
Comment #27
bgrobertson commentedIt should definitely disabled by default. I used this drush command to get it working:
drush vset maxlength_always_for_uid1 1
You can also add this to your settings.php:
Comment #28
danny englanderThe patch in #17 failed but only as it had drupal.org packaging information for the info file. I have excluded that and updated. It now works to solve the issue logged in a user 1, I see the counter and it works as expected. Thanks @dgtlmoon.
Comment #29
capellicThis patch needs work. It assumes that the administrator role is named "administrator". On our sites, the role is "drupal admin". So not only does this nor work, it throws PHP warning messages:
Why not use the administrator role defined by the "Administrator role" field (variable name "user_admin_role") on the account config page (admin/config/people/accounts)? Here's what I came up with:
Comment #30
quironHi,
I have the same issue. My patch is more drastical, for me the bypass function has no utility so I removed it. For me this is working cause nobody will be able to bypass maxlength.
Hope can be useful for someone
Comment #31
firfin commentedWith patch from #28 the counter show for all fields. Without the patch it always shows just for title.
We are getting close, but not there yet?
As for #29, why not just change it to
// Examine the roles
$permissions = user_role_permissions(user_role_load(variable_get(user_admin_role,'administrator')));
If you changed the role_id, then user_admin_role is set as a variable. And if it wasn't set it is 'administrator'.
Or if there is no admin role set it will return no permissions. So this should always work?
Comment #32
kala4ekI think we should not remove bypass functionality.
I guess it will be better to inform user that he have bypass permission and show limit of chars for this field.
Comment #33
sumthief commentedI sympathize with the patch #30.
Because bypass characters limit looks like dangerous functional for me.
I mean that when we use maxlength module and we set limit to the textfield length we can trust that it will have quantity of characters less than or equal to limit. So bypass permission given to users can broke some output for example.
But I'm not sure that my opinion coincides with the opinion of all users.
Comment #34
IRuslan commentedAs I see there is an option to show limit for super admin if you set up 'maxlength_always_for_uid1' variable.
But I think it worth to have a default value for it as TRUE.
Comment #35
emmanvazz commentedI also think it should be off by default. I got confused and had to come to the issues queue to find out that there was a bypass and everything was actually working correctly.
Also when I do turn the bypass off, it still doesn't seem to enforce the max-length.
Comment #36
kala4ekUpdate the patch according to the last conversation.
Comment #37
Anonymous (not verified) commented#36 is simple and elegant at this point.
Although I'd expect this kind of a function to be built-in in the module and be controllable through the UI.
Comment #38
roam2345 commentedwoks for us marking this as RTBC as was really confused was not seeing this no where was documented about this for admin users.
Comment #39
mohaly commentedHello every one, dose any one use this module with D8, I can't apply it to the body field, any suggestions !?
Comment #40
dkre commented@mohaly see https://www.drupal.org/project/maxlength/issues/2496483
Comment #41
bassplaya commentedThank you @nicrodgers !
It should also be in the latest stable version. 7.x-3.3 as of now.
I feel that if more modules would have great accompanying documentation i.e. README.txt than Drupal and the entire community would really benefit from it so much more. I'm gonna give back on this once I find the time. Explore the awesome modules I've am using each time that have robbed me of so much precious time. It's a complaint I see over and over again in the issue queues. I am committed to doing something about that. You can count on me and hold me accountable.
Comment #42
cedeweyHi all,
I've updated the title of the issue and marked this as a feature request for clarity. We are only actively maintaining the Drupal 8/9 version of Maxlength from here on out.
I do appreciate everyone's contributions to this issue. I can see the value in changing the default behavior. If someone is willing to volunteer to maintain the Drupal 7 version please reach out. Otherwise, I encourage everyone to upgrade their websites to Drupal 8/9.
Also, we will be working on addressing what is essentially the opposite problem in the D8/9 version :P https://www.drupal.org/project/maxlength/issues/3195874