Pondering a confusing MaxLength attribute behavior

Discussion in 'HTML' started by clintonG, Oct 15, 2005.

  1. clintonG

    clintonG Guest

    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
    clintonG, Oct 15, 2005
    #1
    1. Advertising

  2. clintonG

    Chris Beall Guest

    clintonG wrote:
    > 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
    Chris Beall, Oct 16, 2005
    #2
    1. Advertising

  3. clintonG wrote:

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


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


    http://validator.w3.org/
    http://www.w3.org/TR/html4/interact/forms.html#h-17.7

    The textarea element doesn't have a maxlength attribute, nor does it have a
    multiline attribute. On the other hand the rows and cols attributes are
    required.

    --
    David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
    Home is where the ~/.bashrc is
    David Dorward, Oct 16, 2005
    #3
  4. clintonG

    clintonG Guest

    "Chris Beall" <> wrote in message
    news:ETf4f.981$...
    > clintonG wrote:
    >> 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


    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
    clintonG, Oct 17, 2005
    #4
  5. clintonG

    clintonG Guest

    "David Dorward" <> wrote in message
    news:dis1qd$6ep$1$...
    > clintonG wrote:
    >
    >> <textarea multiline="2" maxlength="2"></textarea>

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

    >
    > http://validator.w3.org/
    > http://www.w3.org/TR/html4/interact/forms.html#h-17.7
    >
    > The textarea element doesn't have a maxlength attribute, nor does it have
    > a
    > multiline attribute. On the other hand the rows and cols attributes are
    > required.
    >
    > --
    > David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
    > Home is where the ~/.bashrc is


    Thank you for your coments David. Please see my reply to Chris.

    <%= Clinton Gallagher
    clintonG, Oct 17, 2005
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. user 1

    Question I've Been pondering

    user 1, Sep 1, 2003, in forum: HTML
    Replies:
    17
    Views:
    581
  2. gangesmaster
    Replies:
    6
    Views:
    351
    Steven Bethard
    Mar 26, 2006
  3. shapper

    GridView ... confusing behavior

    shapper, Mar 9, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    280
    Greg9Strat
    Mar 9, 2007
  4. scigeek
    Replies:
    7
    Views:
    367
    scigeek
    Sep 8, 2009
  5. paul

    confusing thread behavior

    paul, Dec 3, 2009, in forum: Python
    Replies:
    2
    Views:
    443
Loading...

Share This Page