Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > server-side validation

Reply
Thread Tools

server-side validation

 
 
middletree
Guest
Posts: n/a
 
      02-22-2005
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.


 
Reply With Quote
 
 
 
 
Steven Burn
Guest
Posts: n/a
 
      02-22-2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.
>
>



 
Reply With Quote
 
 
 
 
middletree
Guest
Posts: n/a
 
      02-22-2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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.
> >
> >

>
>



 
Reply With Quote
 
Steven Burn
Guest
Posts: n/a
 
      02-22-2005
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" <(E-Mail Removed)> wrote in message
news:#(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > 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.
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Adrienne
Guest
Posts: n/a
 
      02-22-2005
Gazing into my crystal ball I observed "middletree"
<(E-Mail Removed)> writing in
news:#(E-Mail Removed):

> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> > 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Displaying a Validation Error in a Validation Summary Control Lucas Tam ASP .Net 2 02-26-2004 07:49 PM
ASP.NET Web Forms Validation Controls are Server-Side or Client-Side Validation? Matt ASP .Net 14 01-30-2004 09:15 AM
Web form validation vs object validation Colin Basterfield ASP .Net 1 11-29-2003 12:10 AM
validation summary doesnt display when there's client-side validation Libs ASP .Net 0 06-25-2003 03:05 PM
Re: only custom validation control does server side validation? Colin Mackay ASP .Net 0 06-25-2003 07:54 AM



Advertisments