Re: [apdance9] Character limits and issues
Hi April
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/