www.webdeveloper.com
Results 1 to 5 of 5

Thread: Limit the textbox field size

  1. #1
    Join Date
    Aug 2004
    Posts
    47

    Question Limit the textbox field size

    hi, does anyone know how to solve this problem?


    I have this ASP code

    <FORM METHOD=POST NAME="accessreq" action="accessresp.asp" >

    "<TD align=left bgcolor=#009999>"& "&nbsp;&nbsp;"& "<INPUT TYPE=TEXT
    NAME=accessright"& firstserial &" SIZE=50 >"& "</TD>" &_






    How do i write a code to prompt the user that he/she has reached the maximum length of the text(for example 254) before submitting the form?

    note firstserial is a variable of accumulating number


    Thank alot

  2. #2
    Join Date
    Nov 2004
    Posts
    8
    You can add an attribute to the Input textbox called maxlength. this way the user will not be able to type more than 254 characters.

    <INPUT TYPE=TEXT NAME=accessright"& firstserial &" SIZE=50 MAXLENGTH='254'>


    But if you want to give a user a message, then you'll have to use Javascript.

  3. #3
    Join Date
    Aug 2004
    Posts
    47
    Thank alot dude

  4. #4
    Join Date
    Nov 2004
    Posts
    27
    Javascript is required to tell user he has reached max. length. But you can also put a disabled textbox with lable "Max. Length" and display how many characters left with each keyboard stroke in your textbox or textarea. This method is specifically helpful in case of textarea. You can use div or span with innerHTML to show characters used and available in javascript.

  5. #5
    Join Date
    Nov 2004
    Posts
    27
    sorry,message reposted. admin plz delete.
    Last edited by aspcoder; 12-03-2004 at 01:14 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles