I'm almost done making seperate teaser and body input areas so that I can eliminate the need for the break command by using the excerpt and contemplate modules. All I need to do now is add a maximum word and/or character check/limit the length of the teaser's textarea.
Unfortunately, I've discovered that "textareas" unlike "textfields" (used for much short text entry purposes) do not allow adding the "maxlength" attribute to your form, and the excerpt.module apparently bypasses the normal teaser length controls which Drupal provides (even tried to use a couple contrib modules which said they added teaser control and those didn't work either).
Searching online, most of the solutions I've found involved javascript, but this doesn't seem to be a good solution for any number of reasons. My best lead so far has come from, surprise - here - but I can't figure out how to intergrate it into what I'm working with.
So, basically am trying to add something with the logic similar as this:
<?php
function myform_validate($form_id, $edit) {
if (str_word_count($edit['text']) > 200) {
form_set_error('text', t('Woops! Too many words'));
}
}
?>
to the code for the excerpt module which looks like this:
function excerpt_nodeapi(&$node, $op, $arg) {
switch ($op) {
case 'validate':
if ($node->teaser == '') {
form_set_value($arg['teaser'],isset($node->body) ? node_teaser($node->body, isset($node->format) ? $node->format : NULL) : '');