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.
Hi
I'm not sure whether this is a bug or intended, but no matter what "Maximum length"
I set for my cck input fields it always stays at 128 characters.
Comments
Comment #1
KarenS CreditAttribution: KarenS commentedThis should now be fixed.
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #3
szy CreditAttribution: szy commentedIt happens again with CCK Redirection field.
CCK Redirection adds a text type field with max length of 128 characters, even though
length in database is 255. It's not enough for long URL.
I can see that's because of system_elements(), but why is it so short by default?
Drupal 6.8
CCK Redirection 6.x-1.1
Content Construction Kit (CCK) 6.x-2.x-dev (2008-dec.-09) / 6.x-2.1 (2008-nov.-12)
Thanks,
Szy.
Comment #4
Anonymous (not verified) CreditAttribution: Anonymous commentedI also have this same problem, How can I change the max length to 255?
Comment #5
Anonymous (not verified) CreditAttribution: Anonymous commentedin case anyone else has this problem, it's in the Drupal core code, in the file
modules/system/system.module:
function system_elements():
$type['textfield'] = array(..., '#maxlength' => 128, ...); change to ---> $type['textfield'] = array(..., '#maxlength' => 255, ...);
(don't copy and paste that by the way, the code around #maxlength is just posted for reference purposes so you can find it in the file.)
Comment #6
dawehneroh no! don't hack core!!
there are thousands of ways to solve this problem :)
@szd: This is a problem in the code of cck redirection field, but its easy to fix
Comment #7
Anonymous (not verified) CreditAttribution: Anonymous commentedit's just changing a 128 to a 255, seems like a work-around wouldn't be worth the trouble. I documented the change in a separate file, so any time there's an update, I just refer to that file to re-do the changes.
Comment #8
dawehneranyway thats not good!
you can solve this using hook_form_alter etc.
This is not good what you are doing :)
Comment #9
Anonymous (not verified) CreditAttribution: Anonymous commentedit's the only core change I've ever made, I'm not rampantly hacking core, lol.
Comment #10
Anonymous (not verified) CreditAttribution: Anonymous commentedactually I tried fixing the code in CCK redirection, and even if you go in and change everything in that module from 128 to 255, it still shows up as 128 because of function system_elements() in the system.module file. That's why you have to change system_elements.
Comment #11
Pasqualleany change in core is hacking core. Don't do that, and more importantly do not advise it to others. That is not a solution.
With your fix you probably caused several bugs in your Drupal install, where form elements relies on this value being 128..
Comment #12
szy CreditAttribution: szy commented*edited*
Sorry, please remove my post.
Szy.
Comment #13
markus_petrux CreditAttribution: markus_petrux commentedText fields in CCK allow you to define the size of input elements and also the maxlength.
If the issue is related to another field (#3 suggested it was about CCK Redirection? is that anothe module? ), then please open a report to the proper issues queue.
Comment #15
fatcrobat CreditAttribution: fatcrobat commentedCreate your own little helper Module and create a hook_form_alter like below.
Core hacking is dirty indeed.
Comment #16
kenorb CreditAttribution: kenorb commented#281449: Text field data entry limited to 128 characters with Maximum length blank
Comment #17
crazymind CreditAttribution: crazymind commentedGood day! I try
"modules/system/system.module:
function system_elements():
$type['textfield'] = array(..., '#maxlength' => 128, ...); change to ---> $type['textfield'] = array(..., '#maxlength' => 255, ...);"
and
"
"
but it dont work (.
if use hook_form_alter then id do reload page filed settings after changes and dpr($form) then changes ( $form['basic']['label']['#maxlength'] = 255) do not see (((.
html text of the node elements
input id="edit-field-diagnosticum-file-2-data-description" class="form-text" type="text" value="" size="60" name="field_diagnosticum_file[2][data][description]" maxlength="128"
Comment #18
alirezaara CreditAttribution: alirezaara commentedwhat is the solution in D7?
Comment #19
dariusa CreditAttribution: dariusa commentedFor D7, check out what they're doing here: http://drupal.org/project/field_display_label and modify as needed. Basically, the modified code would look like this:
Comment #20
ahaomar CreditAttribution: ahaomar commentedwhat the solution for Drupal 8 please