Web Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsWeb DesignWeb Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old February 15th, 2005, 08:12 AM
rieflin rieflin is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Location: Roanoke, VA
Posts: 2 rieflin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 55 m 45 sec
Reputation Power: 0
Stumped by textarea limit

I have a form which has several small inputs but also one large input area. Anticipate the entrant will copy and paste 1000-3000 characters. Testing has shown that the limit on the input seems to be about 1036 characters. My reading of the html rules and searches in different forums seem to indicate that no character limit exists.

1. I have tried using both textarea and input type=text and find I can't go past this approx 1000 character barrier.
2. I have tried putting in a maxlength=3000 statement to no avail.

The code snippet is:
<td>Today's Message:</td>
<td> </td>
<td><input textarea name="themessage" cols="60" rows="60"></textarea></td>

My apologies if this is something easy. I have tried to do due dilligence to reading the manuals and such.

Reply With Quote
  #2  
Old February 15th, 2005, 09:23 AM
Madpawn Madpawn is offline
My beat is correct.
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 339 Madpawn User rank is Private First Class (20 - 50 Reputation Level)Madpawn User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Days 22 h 3 m 33 sec
Reputation Power: 4
Are you sending the form via 'get'? That will impose a character limit, since you're sending your info through the url.

Reply With Quote
  #3  
Old February 15th, 2005, 09:54 AM
rieflin rieflin is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Location: Roanoke, VA
Posts: 2 rieflin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 55 m 45 sec
Reputation Power: 0
Talking GET limits number of characters

Quote:
Originally Posted by Madpawn
Are you sending the form via 'get'? That will impose a character limit, since you're sending your info through the url.


Thanks for that tip! I didn't know the answer to that and searched my html document for GET and came up with nothing.

I googled forms and get and found http://www.htmlhelp.com/reference/html40/forms/form.html
which has a section indicating that GET is the default method but does have a limit on characters. That page recommends that POST method be used for the action since my submission has greater than 100 characters.

I don't know that I have ever used POST as my method. May require me to change the way I am coding my PHP/MYSQL web pages. The same page that presents the Web Form is also putting the submitted data into the MYSQL database using PHP.

But Changing the way I code is ok. Better to do it right!

Thanks so much for pointing me in the right direction. I really appreciate that. I have learned so much from devshed.com over the past 2 years and have encouraged 50-100 people to go to your site to educate themselves using the tutorials. This is the best of the web!

Reply With Quote
  #4  
Old February 15th, 2005, 11:44 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
First point, your code snippet is a little incorrect...
Try: <textarea name="themessage" cols="60" rows="60"></textarea> [you had the word input in there]

The Textarea element currently does not support the maxlength attribute...

There is an Internet Explorer proprietary solution, but it only works in IE...
This involves creating an HTC file and setting the style "BEHAVIOR" to direct to that HTC file...

I do not advise this solution, as it is an IE only solution...

The HTC File (titled maxlength.htc)
Code:
<PUBLIC:COMPONENT id="bhvMaxlength" urn="maf:Maxlength">
     <PUBLIC:PROPERTY name="maxLength" />
     <PUBLIC:ATTACH event="onkeypress" handler="doKeypress" />
     <PUBLIC:ATTACH event="onbeforepaste" handler="doBeforePaste" />
     <PUBLIC:ATTACH event="onpaste" handler="doPaste" />

<SCRIPT language="JScript">
// Keep user from entering more than maxLength characters
function doKeypress(){
     if(maxLength && value.length > maxLength-1){
          event.returnValue = false;
          maxLength = parseInt(maxLength);
     }
}
// Cancel default behavior
function doBeforePaste(){
     if(maxLength)
          event.returnValue = false;
}
// Cancel default behavior and create a new paste routine
function doPaste(){
     if(maxLength){
          event.returnValue = false;
          maxLength = parseInt(maxLength);
          var oTR = element.document.selection.createRange();
          var iInsertLength = maxLength - value.length + oTR.text.length;
          var sData = window.clipboardData.getData("Text").substr(0,iInsertLength);
          oTR.text = sData;
     }
}
</SCRIPT>

</PUBLIC:COMPONENT>


Your HTML
Code:
<html>
<head>
<style>
	TEXTAREA { behavior: url(maxlength.htc);}
</style>
</head>

<body>
<form>
	<textarea name="themessage" cols="60" rows="60" maxlength="100"></textarea>
</form>
</body>
</html>


Repeat: I do not advise this solution, as it is an IE only solution...
Instead I suggest pestering the W3C to consider the maxlength property in the next XHTML spec revision
In the meantime, always do server side validation... also code a javascript validation

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsWeb DesignWeb Development > Stumped by textarea limit


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway