Character limits and issues
6 posts by 3 authors in: Forums > CMS Builder
Last Post: March 17, 2009 (RSS)
By design9 - March 2, 2009
This is the problem: both web editors have stated that everytime they go to post that the system tells them they have went over the limit by 2000 to 4000 characters which is not the case. For some reason, their computer is remembering old data and I have also advised the editors to clear out their cache in their browser. One said that this doesn't fix it. I know one user is using the newest Firefox browser. Also, these web editors are not very web technical based and have older computers.
When I have tested this on different computers and browsers, I don't experience any such problem. Do you have any idea of why they both would experience this issue and any way to fix this?
April
Re: [apdance9] Character limits and issues
By ross - March 2, 2009
Thanks for posting!
What's happening here is the character counter is also counting the HTML that is auto created by your WYSIWYG editor when you start typing. The easiest solution would be to switch that field over to a plain text box.
You wouldn't get the formatting options like bold/italics/etc, but it would mean the character count is accurate.
Let me know what you think :).
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com
Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/
Re: [ross] Character limits and issues
By design9 - March 2, 2009
Thanks for a quick reply!
The only issue is that I need to use the WYSIWYG editor because our web editors need to be able to easily add links in their text as they do not have any basic html knowledge to write links on their own.
Is there any way around it using the WYSIWYG or do you have any other solutions?
Thanks!
April
Re: [apdance9] Character limits and issues
By Dave - March 2, 2009
We could update the code to have it apply to the text content of the wysiwyg only (ignoring html tags). That would probably make more sense. Would that work for you?
interactivetools.com
Re: [apdance9] Character limits and issues
By ross - March 2, 2009
If the way Dave described is the way you want to go, I have a fix for you :). It will be included in the next version of CMS Builder but for now, you can open up this file:
/lib/menus/default/save.php
and find this block of code:
if ($value != '' && @$fieldSchema['minLength'] && $length < $fieldSchema['minLength']) {
$errors .= sprintf(__('\'%1$s\' must be at least %2$s characters! (currently %3$s characters)'), $labelOrName, $fieldSchema['minLength'], $length) . "\n";
}
if ($value != '' && @$fieldSchema['maxLength'] && $length > $fieldSchema['maxLength']) {
$errors .= sprintf(__('\'%1$s\' cannot be longer than %2$s characters! (currently %3$s characters)'), $labelOrName, $fieldSchema['maxLength'], $length) . "\n";
}
It will start on line 106. Replace that while block with this whole block:
// check min/max length of content
$textLength = ($fieldSchema['type'] == 'wysiwyg') ? strlen(strip_tags($value)) : strlen($value);
if ($value != '' && @$fieldSchema['minLength'] && $textLength < $fieldSchema['minLength']) {
$errors .= sprintf(__('\'%1$s\' must be at least %2$s characters! (currently %3$s characters)'), $labelOrName, $fieldSchema['minLength'], $textLength) . "\n";
}
if ($value != '' && @$fieldSchema['maxLength'] && $textLength > $fieldSchema['maxLength']) {
$errors .= sprintf(__('\'%1$s\' cannot be longer than %2$s characters! (currently %3$s characters)'), $labelOrName, $fieldSchema['maxLength'], $textLength) . "\n";
}
Give it a shot and let me know how you make out :).
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com
Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/
Re: [ross] Character limits and issues
By design9 - March 17, 2009
April