Pondering a confusing MaxLength attribute behavior

C

clintonG

Hmmm... I seem to have lost all understanding of how some HTML elements
function.
Example...

<textarea multiline="2" maxlength="2"></textarea>
<br />
<input maxlength="2" />

Why does the textarea not prevent entering more characters than its
maxlength value the same way the input element will?

<%= Clinton Gallagher
 
C

Chris Beall

clintonG said:
Hmmm... I seem to have lost all understanding of how some HTML elements
function.
Example...

<textarea multiline="2" maxlength="2"></textarea>
<br />
<input maxlength="2" />

Why does the textarea not prevent entering more characters than its
maxlength value the same way the input element will?

<%= Clinton Gallagher
Clinton,

See http://www.w3.org/TR/html401/interact/forms.html#edef-TEXTAREA

multiline and maxlength are not attributes of the textarea element.

See http://www.w3.org/TR/html401/index/attributes.html

multiline is not an HTML attribute at all.

Perhaps you are thinking of some other language?

Chris Beall
 
D

David Dorward

C

clintonG

Chris Beall said:
Clinton,

See http://www.w3.org/TR/html401/interact/forms.html#edef-TEXTAREA

multiline and maxlength are not attributes of the textarea element.

See http://www.w3.org/TR/html401/index/attributes.html

multiline is not an HTML attribute at all.

Perhaps you are thinking of some other language?

Chris Beall

I've been deep into the mire of using Visual Studio to learn C# and the .NET
Framework. The control attributes used by Visual Studio have different names
but render as HTML elements after the page is compiled. I've been at this a
long time and have coded for years using HomeSite but I realized I've simply
lost touch with some of the finer points of HTML as expressed by attributes
which certain elements support.

I don't know why Microsoft felt compelled to use different attribute names
in their server-side controls. It can occassionally become very confusing as
this topic confirms.

I don't think I've ever come to terms with why an input element (ASP.NET
Textbox control) can limit the number of characters entered while an
textarea (ASP.NET Textbox control which supports MaxLength property)
requires the use of script. Thank you for providing the reference to W3C
Chris.

<%= Clinton Gallagher
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top