Remaining Characters not working after failed submission
scoorch - May 23, 2009 - 20:51
| Project: | Maxlength |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | needs review |
Description
If the maximum length of the title or body field is exceeded and the form is submitted the message appears:
The body field has exceeded its maximum number of characters
After this failed submission the remaining characters are not updated.
The problem also occurs if the form submission fails due to any other reason, e.g. the required title was not entered.

#1
Do others have this problem as well? Just wondering because I think the module can hardly be used in a production environment with this bug...
#2
I have the same issue.
#3
Yep, me too. But note that I use it in combination with TinyMCE and the js_editor patch (http://drupal.org/node/314508#comment-1695260)
#4
Been bitten by this one too. Attached is a patch which fixes this. The key for success is #after_build since form_alter isn't invoked when at validation errors occur. I still left a lot of debugging code and didn't remove all code yet so others can play with it as well. Apply against latest dev version.
#5
Cool that is definitive a better way to do it.
#6
I had this issue as well.... until I added a CCK field to my node type. Now, it appears that form_alter is hit after a validation error despite the fact that I am only using maxlength on the title and body.
Why is it the case that without a CCK field I experience this behaviour, but once I add a custom field everything works as expected? I took a look through the code and didn't see anything specific to CCK that would cause form_alter to be called. Is this happening within CCK for some reason?