server-side validation

Discussion in 'ASP General' started by middletree, Feb 22, 2005.

  1. middletree

    middletree Guest

    I posted this yesterday afternoon, but for some reason, I don't see it in my
    newsreader, on either of my 2 computers. So I am re-posting.


    I'd like to see if there is any guidance in the form of sample code or a
    tutorial for server-side validation. Specifically for the thing I am trying
    to do, if a user types too many letters into Textarea, then they see an
    error on the screen. I was able to catch most occurrences of this error with
    client-side javascript. However, I'd like to handle it server-side in order
    to catch those cases that get by the javascript for whatever reason. If I
    could just catch the error before it gets displayed, then display a warning
    in red letters in a pretty format, then that's all I'm hoping to do.

    I went to ASPFAQ.com, didn't find anything there. I also did a search of
    this forum and didn't see anything. I know conceptually what I want to do,
    but I am not sure how to go about it.
     
    middletree, Feb 22, 2005
    #1
    1. Advertising

  2. middletree

    Steven Burn Guest

    sTemp = Request.Form("txtaSomeTextArea")
    If Len(sTemp) > 1000 Then
    Response.Redirect "/?err=1&tmp=" & sTemp
    End If

    '// Example form
    <%
    If Request.Querystring("err") <> "" Then Response.Write "Error: Too many
    characters<br><br>"
    %>
    <form action="thispage.asp" name="frmTemp">
    <textarea name="txtaSomeTextArea"><%if len(request.querystring("tmp") > 0
    Then%><%=request.querystring("tmp")%><%end if%></textarea>
    <input type="submit" name="btnSubmit">
    </form>

    --
    Regards

    Steven Burn
    Ur I.T. Mate Group
    www.it-mate.co.uk

    Keeping it FREE!

    "middletree" <> wrote in message
    news:...
    > I posted this yesterday afternoon, but for some reason, I don't see it in

    my
    > newsreader, on either of my 2 computers. So I am re-posting.
    >
    >
    > I'd like to see if there is any guidance in the form of sample code or a
    > tutorial for server-side validation. Specifically for the thing I am

    trying
    > to do, if a user types too many letters into Textarea, then they see an
    > error on the screen. I was able to catch most occurrences of this error

    with
    > client-side javascript. However, I'd like to handle it server-side in

    order
    > to catch those cases that get by the javascript for whatever reason. If I
    > could just catch the error before it gets displayed, then display a

    warning
    > in red letters in a pretty format, then that's all I'm hoping to do.
    >
    > I went to ASPFAQ.com, didn't find anything there. I also did a search of
    > this forum and didn't see anything. I know conceptually what I want to

    do,
    > but I am not sure how to go about it.
    >
    >
     
    Steven Burn, Feb 22, 2005
    #2
    1. Advertising

  3. middletree

    middletree Guest

    OK, this is a good answer. It comes from a completely different direction
    from what I was thinking. I was thinking I'd have to come up with code which
    read the SQL Server error after it had been generated and displayed my
    customer message instead of the SQL/ASP error. Your solution captures the
    problem before it gets that far. I like this. I see where it will take some
    work to capture all the other parts of the form and put them back into
    place, but it will be worth doing.

    thanks very much!




    "Steven Burn" <> wrote in message
    news:...
    > sTemp = Request.Form("txtaSomeTextArea")
    > If Len(sTemp) > 1000 Then
    > Response.Redirect "/?err=1&tmp=" & sTemp
    > End If
    >
    > '// Example form
    > <%
    > If Request.Querystring("err") <> "" Then Response.Write "Error: Too

    many
    > characters<br><br>"
    > %>
    > <form action="thispage.asp" name="frmTemp">
    > <textarea name="txtaSomeTextArea"><%if len(request.querystring("tmp") > 0
    > Then%><%=request.querystring("tmp")%><%end if%></textarea>
    > <input type="submit" name="btnSubmit">
    > </form>
    >
    > --
    > Regards
    >
    > Steven Burn
    > Ur I.T. Mate Group
    > www.it-mate.co.uk
    >
    > Keeping it FREE!
    >
    > "middletree" <> wrote in message
    > news:...
    > > I posted this yesterday afternoon, but for some reason, I don't see it

    in
    > my
    > > newsreader, on either of my 2 computers. So I am re-posting.
    > >
    > >
    > > I'd like to see if there is any guidance in the form of sample code or a
    > > tutorial for server-side validation. Specifically for the thing I am

    > trying
    > > to do, if a user types too many letters into Textarea, then they see an
    > > error on the screen. I was able to catch most occurrences of this error

    > with
    > > client-side javascript. However, I'd like to handle it server-side in

    > order
    > > to catch those cases that get by the javascript for whatever reason. If

    I
    > > could just catch the error before it gets displayed, then display a

    > warning
    > > in red letters in a pretty format, then that's all I'm hoping to do.
    > >
    > > I went to ASPFAQ.com, didn't find anything there. I also did a search of
    > > this forum and didn't see anything. I know conceptually what I want to

    > do,
    > > but I am not sure how to go about it.
    > >
    > >

    >
    >
     
    middletree, Feb 22, 2005
    #3
  4. middletree

    Steven Burn Guest

    I was never one for complicating things (brain farts excluded of course
    <g>)...

    .... and your welcome ;o)

    --
    Regards

    Steven Burn
    Ur I.T. Mate Group
    www.it-mate.co.uk

    Keeping it FREE!

    "middletree" <> wrote in message
    news:#...
    > OK, this is a good answer. It comes from a completely different direction
    > from what I was thinking. I was thinking I'd have to come up with code

    which
    > read the SQL Server error after it had been generated and displayed my
    > customer message instead of the SQL/ASP error. Your solution captures the
    > problem before it gets that far. I like this. I see where it will take

    some
    > work to capture all the other parts of the form and put them back into
    > place, but it will be worth doing.
    >
    > thanks very much!
    >
    >
    >
    >
    > "Steven Burn" <> wrote in message
    > news:...
    > > sTemp = Request.Form("txtaSomeTextArea")
    > > If Len(sTemp) > 1000 Then
    > > Response.Redirect "/?err=1&tmp=" & sTemp
    > > End If
    > >
    > > '// Example form
    > > <%
    > > If Request.Querystring("err") <> "" Then Response.Write "Error: Too

    > many
    > > characters<br><br>"
    > > %>
    > > <form action="thispage.asp" name="frmTemp">
    > > <textarea name="txtaSomeTextArea"><%if len(request.querystring("tmp") >

    0
    > > Then%><%=request.querystring("tmp")%><%end if%></textarea>
    > > <input type="submit" name="btnSubmit">
    > > </form>
    > >
    > > --
    > > Regards
    > >
    > > Steven Burn
    > > Ur I.T. Mate Group
    > > www.it-mate.co.uk
    > >
    > > Keeping it FREE!
    > >
    > > "middletree" <> wrote in message
    > > news:...
    > > > I posted this yesterday afternoon, but for some reason, I don't see it

    > in
    > > my
    > > > newsreader, on either of my 2 computers. So I am re-posting.
    > > >
    > > >
    > > > I'd like to see if there is any guidance in the form of sample code or

    a
    > > > tutorial for server-side validation. Specifically for the thing I am

    > > trying
    > > > to do, if a user types too many letters into Textarea, then they see

    an
    > > > error on the screen. I was able to catch most occurrences of this

    error
    > > with
    > > > client-side javascript. However, I'd like to handle it server-side in

    > > order
    > > > to catch those cases that get by the javascript for whatever reason.

    If
    > I
    > > > could just catch the error before it gets displayed, then display a

    > > warning
    > > > in red letters in a pretty format, then that's all I'm hoping to do.
    > > >
    > > > I went to ASPFAQ.com, didn't find anything there. I also did a search

    of
    > > > this forum and didn't see anything. I know conceptually what I want

    to
    > > do,
    > > > but I am not sure how to go about it.
    > > >
    > > >

    > >
    > >

    >
    >
     
    Steven Burn, Feb 22, 2005
    #4
  5. middletree

    Adrienne Guest

    Gazing into my crystal ball I observed "middletree"
    <> writing in
    news:#:

    > OK, this is a good answer. It comes from a completely different
    > direction from what I was thinking. I was thinking I'd have to come up
    > with code which read the SQL Server error after it had been generated
    > and displayed my customer message instead of the SQL/ASP error. Your
    > solution captures the problem before it gets that far. I like this. I
    > see where it will take some work to capture all the other parts of the
    > form and put them back into place, but it will be worth doing.
    >
    > thanks very much!
    >


    You might like some of the stuff at
    http://www.intraproducts.com/beta/requiredform.asp , does some other server
    side validation and has a good way to display errors to the client.
    >
    >
    >
    > "Steven Burn" <> wrote in message
    > news:...
    >> sTemp = Request.Form("txtaSomeTextArea")
    >> If Len(sTemp) > 1000 Then
    >> Response.Redirect "/?err=1&tmp=" & sTemp
    >> End If
    >>
    >> '// Example form
    >> <%
    >> If Request.Querystring("err") <> "" Then Response.Write "Error:
    >> Too many characters<br><br>" %>
    >> <form action="thispage.asp" name="frmTemp">
    >> <textarea name="txtaSomeTextArea"><%if len(request.querystring("tmp")
    >> > 0 Then%><%=request.querystring("tmp")%><%end if%></textarea>

    >> <input type="submit" name="btnSubmit"> </form>
    >>
    >> --
    >> Regards
    >>
    >> Steven Burn
    >> Ur I.T. Mate Group www.it-mate.co.uk
    >>
    >> Keeping it FREE!
    >>
    >> "middletree" <> wrote in message
    >> news:...
    >> > I posted this yesterday afternoon, but for some reason, I don't see
    >> > it in my newsreader, on either of my 2 computers. So I am
    >> > re-posting.
    >> >
    >> >
    >> > I'd like to see if there is any guidance in the form of sample code
    >> > or a tutorial for server-side validation. Specifically for the thing
    >> > I am trying to do, if a user types too many letters into Textarea,
    >> > then they see an error on the screen. I was able to catch most
    >> > occurrences of this error with client-side javascript. However, I'd
    >> > like to handle it server-side in order to catch those cases that get
    >> > by the javascript for whatever reason. If I could just catch the
    >> > error before it gets displayed, then display a warning in red
    >> > letters in a pretty format, then that's all I'm hoping to do.
    >> >
    >> > I went to ASPFAQ.com, didn't find anything there. I also did a
    >> > search of this forum and didn't see anything. I know conceptually
    >> > what I want to do, but I am not sure how to go about it.
    >> >
    >> >

    >>
    >>

    >
    >




    --
    Adrienne Boswell
    http://www.cavalcade-of-coding.info
    Please respond to the group so others can share
     
    Adrienne, Feb 22, 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. Colin Mackay
    Replies:
    0
    Views:
    2,695
    Colin Mackay
    Jun 25, 2003
  2. Matt
    Replies:
    14
    Views:
    4,109
    Chad Z. Hower aka Kudzu
    Jan 30, 2004
  3. Mythran
    Replies:
    2
    Views:
    515
    Mythran
    Jan 22, 2005
  4. =?Utf-8?B?dmlkeWE=?=
    Replies:
    1
    Views:
    756
    Kevin Spencer
    Jun 2, 2005
  5. Thor
    Replies:
    1
    Views:
    1,023
    Mikkel Heisterberg
    Jul 2, 2003
Loading...

Share This Page