LITTLEBLACKDOG.COM Forum Index LITTLEBLACKDOG.COM

 
LWD LWD   FAQ FAQ   Memberlist Memberlist   Usergroups Usergroups   Active Topics Active Topics   Register Register  
  Profile Profile   Log in to check your private messages Log in to check your private messages   Log in Log in  
  Who is Online Who is Online   Image Gallery Image Gallery   Chat Chat   Search Search  
  LWDGear       LBDGear  

View next topic
View previous topic
Post new topic     Reply to topic   LITTLEBLACKDOG.COM Forum Index » Code Warriors
Author Message
drums
Toilet Drinker
Toilet Drinker


Joined: 19 Jun 2003
Posts: 234
Location: Portland, OR

Post Posted: Tue Dec 15, 2009 8:52 pm   Post subject: Anyone know why maxlength is invalid? Reply with quote Back to top  

I get this error on a form mail.
Quote:
Attribute "MAXLENGTH" is not a valid attribute. Did you mean "maxlength"?

<br><textarea name="Message" maxlength="1000" class="text blkbars" cols="30" row

You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).

This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.

How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute. If you received this error when using the <embed> element to incorporate flash media in a Web page, see the FAQ item on valid flash.


I have it in lowercase and here's my doctype stuff (not sure what it's called). There are a total of 8 of these email (form mail) pop-up pages:
Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

And the HTML
Code: Select all
<textarea name="Message" maxlength="1000" class="text blkbars" cols="30" rows="5">


Thanks in advance for your time and hopefully help!

_________________
View user's profile Send private message
CMTG
Leg Humper
Leg Humper


Joined: 23 Feb 2002
Posts: 5438
Location: /var/log/cabin

Post Posted: Wed Dec 16, 2009 4:04 am   Post subject: Reply with quote Back to top  

It's because "maxlength" is not a valid attribute for the <textarea/> element, just like the error message says.

See: http://www.w3schools.com/tags/tag_textarea.asp

_________________
Pie. I wish I could
constrain my hungry greed but...
Sadly, defeated.


Charlene's Law: There's no such thing as can't.
Charlene's Corollary: Unless it's followed by be arsed.


I write more quotes than a fucking big book of quotes. - Scroobius Pip
View user's profile Send private message Send e-mail Visit poster's website
gregw
Tail-Wagger
Tail-Wagger


Joined: 25 May 2003
Posts: 2990
Location: About 2000 miles south of where I want to be.

Post Posted: Wed Dec 16, 2009 7:49 am   Post subject: Reply with quote Back to top  

AS CMTG said, unlike a text box, the text area cannot be controlled via maxlength. You can, however, control it via javascript. So if you want to limit the amount of text a user inputs, here's one of many examples:

http://www.dynamicdrive.com/dynamicindex16/maxlength.htm

_________________
Some people are like slinkys... not really good for anything but they still bring a smile to your face when you push them down a flight of stairs.
View user's profile Send private message
drums
Toilet Drinker
Toilet Drinker


Joined: 19 Jun 2003
Posts: 234
Location: Portland, OR

Post Posted: Wed Dec 16, 2009 11:29 am   Post subject: Reply with quote Back to top  

Thansk for clearing it up. I'll try the javascript

_________________
View user's profile Send private message
drums
Toilet Drinker
Toilet Drinker


Joined: 19 Jun 2003
Posts: 234
Location: Portland, OR

Post Posted: Wed Dec 16, 2009 12:53 pm   Post subject: Reply with quote Back to top  

I tried the javascript which works fine but I still get a validation error.

So does anyone know how to do this with CSS? That way I can eliminate the maxlength from the textarea.

Thanks,

_________________
View user's profile Send private message
CMTG
Leg Humper
Leg Humper


Joined: 23 Feb 2002
Posts: 5438
Location: /var/log/cabin

Post Posted: Wed Dec 16, 2009 3:21 pm   Post subject: Reply with quote Back to top  

drums wrote:
I tried the javascript which works fine but I still get a validation error.

So does anyone know how to do this with CSS? That way I can eliminate the maxlength from the textarea.

Thanks,


Just delete the maxlength attribute. You don't have to do anything in CSS because it's not having any affect on your textarea anyway. It's an invalid attribute!

_________________
Pie. I wish I could
constrain my hungry greed but...
Sadly, defeated.


Charlene's Law: There's no such thing as can't.
Charlene's Corollary: Unless it's followed by be arsed.


I write more quotes than a fucking big book of quotes. - Scroobius Pip
View user's profile Send private message Send e-mail Visit poster's website
drums
Toilet Drinker
Toilet Drinker


Joined: 19 Jun 2003
Posts: 234
Location: Portland, OR

Post Posted: Wed Dec 16, 2009 3:41 pm   Post subject: Reply with quote Back to top  

Thanks, you're right and I did and all is well. I found a nifty piece of javascript to do it but wish it did more because right now if you reach the max length it freezes you out of the text area meaning you can't do any editing in there like delete text; you can go to other fields and do things but just not in the textarea. I'm going to work on it later to see if I can make it more complete so it either warns or at least returns the cursor functionality in there. It's very similar to the one gregw pointed me to but simpler.
Code: Select all
<script language="javascript" type="text/javascript">
<!--
function imposeMaxLength(Object, MaxLen)
{
  return (Object.value.length <= MaxLen);
}
-->
</script>

And the HTML
Code: Select all
onkeypress="return imposeMaxLength(this, 1000);"


So if you or anyone else has some ideas I'm all ears/eyes...

_________________
View user's profile Send private message
Display posts from previous:   
Post new topic     Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group
phpBB SEO
All times are GMT - 8 Hours

Help us keep advertisements off this site. Donate today!