SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Wizard rozner's Avatar
    Join Date
    Oct 2002
    Location
    Paris
    Posts
    1,058
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    max length on a text input

    Anyone know what the default maxlength is on an input?

    If I don't specify a maxlength, is there a limit to how much will get sent to the server?

    Thanks

  2. #2
    SitePoint Evangelist elgumbo's Avatar
    Join Date
    Nov 2002
    Location
    North West, UK
    Posts
    545
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    According to w3c, the default value for the MAXLENGTH attribute is an unlimited number. So if you don't specify the max a user could cut and paste the bible a couple of times and stick it in your form.

    Even if you do specify the MAXLENGTH to a reasonable number make sure you double check the length of the submitted data on the server before processing (using something like php or asp) as it's quite easy to get around the basic MAXLENGTH restriction anyway.

  3. #3
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Also note that if you use method="get" (which is the default) there may be user agent-specific limitations on the resulting URI length. If you expect long string values, use method="post".
    Birnam wood is come to Dunsinane

  4. #4
    SitePoint Member cipals15's Avatar
    Join Date
    Nov 2008
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Also try to ask the server if they are truncating the sent data.

  5. #5
    SitePoint Member
    Join Date
    Nov 2008
    Location
    Bellevue, WA
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by rozner View Post
    Anyone know what the default maxlength is on an input?

    If I don't specify a maxlength, is there a limit to how much will get sent to the server?

    Thanks
    Hi,

    In my opinion, "maximum length depends upon you whatever you fix. but the default width is 145 in Firefox, 148 in safari and 146 in IE 7". all measurements are in pixels.

    Thanks

  6. #6
    SitePoint Evangelist elgumbo's Avatar
    Join Date
    Nov 2002
    Location
    North West, UK
    Posts
    545
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by andrew_inix View Post
    Hi,

    In my opinion, "maximum length depends upon you whatever you fix. but the default width is 145 in Firefox, 148 in safari and 146 in IE 7". all measurements are in pixels.

    Thanks
    No maxlength relates the ammount of data that can entered via the text box and not the physical length of the box. The "size" attribute controls the length of the box as displayed on the browser page.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •