Looking for a problem I am having with Maxlength, and was thinking that others might possibly have the same problem.
The maxlength counter is not displayed under the body textarea on the node/add page to create a new node, however it IS displayed on the node/edit page when editing an existing node. The maxlength constraint still works. (if you submit a node form that exceeds the given max length it gives you an error and displays the form, now with the counter.) This isn't the desired behavior, is it? It seems to me that my form on the node/add just isn't being given the
Could it be the 'theme' function ?
function theme_maxlength_textarea($element) {
$prefix = '';
if ($element['#name'] == 'body') { .....
I noticed my form doesn't seem to have a #name element, looks like this:
[body] => Array
(
[#type] => textarea
[#title] => Message
[#default_value] =>
[#rows] => 20
[#required] =>
)
I haven't used form_alter or anything that I can think of that would change the standard node form. Any ideas?
Comments
Comment #1
ericpughoops..
I meant to say that the textarea isn't being wrap in:
Comment #2
mariuss commentedIs this a custom content type? What did you use to create it?
Can you do a quick test and apply maxlength to story or page, just to see if it works for those?
Comment #3
ericpughHi thanks for a response. Yes I am using custom content types (CCK) containing text fields, date, and Imagefield. I also tried it with the default page and blog content types. (still no max counter)
It won't post if you exceed the given max length, so something is working right. I'm trying to find out what is interfering. I disabled most other modules, that might be the cause. (like "form filter") Here is my javascript being loaded.
I've installed maxlength on a clean install, created a similar content type, and it worked perfectly! I'll have to keep digging. Of course, I'll post here what I come up with, possibly help someone else.
Comment #4
ericpughArrgh! Figured it out. I had two similar CCK content types one had an image upload, and the other didn't, so I named them message_image and message_text. Removed the underscore, and now it works. (another aarrgh!)
Drupal does allow underscores for content type names, but I'm guessing that what's happening is that drupal changes underscores into dashes in the URL and maxlength collects this as $type from arg(2). Which later creates an incorrect value for $form_id. ...umm I think?.
thx
Comment #5
mcurry commentedsubscribe