Closed Bug 266335 Opened 20 years ago Closed 20 years ago

Javascript "length" doesn't return the correct amount of characters in textareas if there are carriage returns.

Categories

(Firefox :: General, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 188015

People

(Reporter: david.prusak, Assigned: bugzilla)

References

()

Details

User-Agent:       Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20040913 Firefox/0.10.1 

MSIE, each carriage return is counted as 2 characters (correct as that's how 
many are being submitted) (carriage return/linefeed)

Mozilla/Netscape/Firebird Returns the count as 1 character but submits 2.
(carriage return/linefeed)

This breaks form validation on the client side.

Reproducible: Always
Steps to Reproduce:
1. Visit http://www.prusak.net/testcount.html
2. Enter a single carriage return in the text area field.
3. Click on the Count link so that Javascript can tell you how many characters 
are in the field.
Actual Results:  
Mozilla*(firebird, netscape) returns "1".  MSIE returns "2"


Expected Results:  
Javascript should return the number of characters that it's going to submit.  

If you submit the data, I return the HTML Encoded data back to you so you can 
see what was submitted by the form.  A single carriage return is submitted 
as "%0D%0A"  That's 2 characters.

*** This bug has been marked as a duplicate of 188015 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.