Professional Web Applications Themes

restrict entry in a Multi line text box - ASP

If they put 25,000 characters in there, you don't have to show them all on the web page. Let them store whatever they want, then when those design requirements change, they won't have to go and restore whatever text you wouldn't let them enter before. To see a few methods of extracting an excerpt: [url]http://www.aspfaq.com/2398[/url] "Henry" <paulthemedialounge.com> wrote in message news:eC#0dcgSDHA.2148TK2MSFTNGP11.phx.gbl... > Is there any way to ensure that users of my system only enter so many lines > into a multi line text box. > > That damn scroll bar gets me every time. > > I dont want ...

  1. #1

    Default Re: restrict entry in a Multi line text box

    If they put 25,000 characters in there, you don't have to show them all on
    the web page. Let them store whatever they want, then when those design
    requirements change, they won't have to go and restore whatever text you
    wouldn't let them enter before. To see a few methods of extracting an
    excerpt:

    [url]http://www.aspfaq.com/2398[/url]




    "Henry" <paulthemedialounge.com> wrote in message
    news:eC#0dcgSDHA.2148TK2MSFTNGP11.phx.gbl...
    > Is there any way to ensure that users of my system only enter so many
    lines
    > into a multi line text box.
    >
    > That damn scroll bar gets me every time.
    >
    > I dont want the users to enter in so much data that the memo field drifts
    > off the page when displaying. I have to avoid scroll bars on the web
    page.
    >
    > How do you people overcome this ?
    >
    > Thanks in Advance
    >
    >
    >
    >

    Aaron Bertrand - MVP Guest

  2. #2

    Default Re: restrict entry in a Multi line text box

    > That wouldnt work in my case.
    >
    > The users need to be able to put carriage returns and line spaces in.
    How does this solution fail to allow carriage returns and line feeds?


    Aaron Bertrand - MVP Guest

  3. #3

    Default Re: restrict entry in a Multi line text box

    Gazing into my crystal ball I observed "Henry" <paulthemedialounge.com>
    writing in news:eC#0dcgSDHA.2148TK2MSFTNGP11.phx.gbl:
    > Is there any way to ensure that users of my system only enter so many
    > lines into a multi line text box.
    >
    > That damn scroll bar gets me every time.
    >
    > I dont want the users to enter in so much data that the memo field
    > drifts off the page when displaying. I have to avoid scroll bars on
    > the web page.
    >
    > How do you people overcome this ?
    >
    > Thanks in Advance
    >
    >
    >
    >
    Here's what you can do. On the form itself:

    <label for="field">Limit 4 Rows - 200 characters</label><br />
    <textarea cols="50" rows="4" id="field" name="field" style="font-
    family:'courier-new, courier, mono-space'"></textarea>


    On the page where the form is being posted to check for the length of
    field:
    if len(trim(request.form("field"))) > 200 then
    'give an error message, send them back to the originating form, etc
    else
    'do the rest of your form processing
    end if

    By setting a monospace font, you are at least giving the user some idea of
    how many characters have been typed in. There no size attribute in the
    Textarea element as there is in the input type=text element.

    --
    Adrienne Boswell
    Please respond to the group so others can share
    [url]http://www.arbpen.com[/url]
    Adrienne Guest

  4. #4

    Default Re: restrict entry in a Multi line text box

    > By setting a monospace font, you are at least giving the user some idea of
    > how many characters have been typed in. There no size attribute in the
    > Textarea element as there is in the input type=text element.
    Or you could do something like this (IE only). To keep it on-topic, I set
    the maximum from ASP. :-)

    <%
    maxChars = 100
    %>

    <form name=foo>
    <textarea style='width:300;height:200'
    name=bar
    onkeyup='show(this.value.length);'></textarea>
    </form>
    You have typed <span id=count>0</span> characters.

    <script>
    function show(i)
    {
    doent.all("count").innerHTML = i;
    if (i>=<%=maxChars%>)
    {
    alert('You can only have <%=maxChars%> characters.');
    }
    }
    </script>


    Aaron Bertrand - MVP Guest

Similar Threads

  1. Buttons with Multi-Line Text
    By Wayne Gibson in forum Macromedia Flex General Discussion
    Replies: 0
    Last Post: February 7th, 05:14 PM
  2. Multi-line TextBox - Paste text with numbered list, bullet list, tab character
    By tony_csnet@yahoo.com in forum ASP.NET Building Controls
    Replies: 0
    Last Post: November 9th, 07:04 PM
  3. Create multi-line point text from applescript in CS
    By spike_grobstein@adobeforums.com in forum Adobe Illustrator Macintosh
    Replies: 2
    Last Post: May 5th, 04:50 PM
  4. multi-line text field in dataset passed to web services
    By tms@tms.com in forum ASP.NET Web Services
    Replies: 2
    Last Post: March 6th, 07:28 AM
  5. Multi-line text
    By Barb K in forum Adobe Photoshop Elements
    Replies: 0
    Last Post: July 24th, 04:13 PM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139