Problem/Motivation

After installing maxlength on my site, I observed that while it works well for new data, old data that exceeds the newly determined field length is not truncated.

Proposed resolution

Truncate the text field on form_alter prior to displaying it to the user.

Remaining tasks

Verify the to-be-attached patch and determine if the method is acceptable.

User interface changes

Perhaps add a setting to allow users to turn the truncation option on and off?

CommentFileSizeAuthor
#2 preexisting_text_not-2834483-2.patch1.37 KBmerauluka
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

merauluka created an issue. See original summary.

merauluka’s picture

Kingdutch’s picture

I just want to chime in that I think this is how the module should function. Altering existing user data when enabling this is probably a jarring experience and could experience to data loss. It's probably better not to touch existing data and let the user decide how to deal with it. That might mean that a user has to revisit each existing node if they want to data to be made shorter. However, if the text is arbitrarily cut off after a certain amount of characters then the user will have to do that anyway because texts on their sites will suddenly

realityloop’s picture

Isn't this more safely implemented by truncating the output rather than choping the saved data without the user realising?

larowlan’s picture

Status: Active » Closed (won't fix)

This feels like a site-specific concern that could be handled in an update hook we don't want to be causing data-loss.