NameSilo

ASP-form validation

Spaceship Spaceship
Watch

crazyluv

Established Member
Impact
2
I am making a custom submission form for one of my webpages and was wondering what is the best way to validate the information entered into the form.

Should I use javascript with a pop-up button for errors or should I use ASP code to verify and redirect?

I want the contents of the form to remain intact since in would be a bit of an inconvience to have to rewrite everything, so if I go with ASP is there an easy way to repopulate a form or do I have to custom build it with variables? Including one for posting the error at the top of the page?

The page as various forms I have to submit one after another till everything is done, all of which are located on the same ASP page, is that ok?
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
You should use ASP (server-side) for validation purposes.
Some basic validation in javascript is also a plus (quicker and it prevents round trips between browser and server). But it may be disabled on the client browser.
Never ever rely on client-based validation !

Also you can program your form to call itself so that if errors are reported, it can remember the input on the previous screen so it need not be type in again.
 
0
•••
I see your point, so ASP validation it is (I was leaning towards this anyway). May seem silly but how do I get it to call itself and retain it's values?
 
0
•••
crazyluv said:
I see your point, so ASP validation it is (I was leaning towards this anyway). May seem silly but how do I get it to call itself and retain it's values?

Build the form and echo it with response.write.

sorta like

<%
response.write("<input type=hidden name=UID value=" & request.form("UID") & ">")
%>

Thats quick and cheesy. Someone could easily fake their header and pass you an unexpected/unwanted value. I prefer to vet the form values in the head and assign them to variables that you use to load the form...



<%

dim ok_value

' checks the value is a number.
' you'd probably want real bounds checking here..
if (isnumeric(request.form("UID"))) then

ok_value=request.form("UID")

end if
.
.
.

response.write("<input type=hidden name=UID value=" & ok_value & ">")

%>



Late at night and I'm pretty tired. apologies for any syntax errors :D
 
0
•••
Thanks! I'll try it out later. Muchas Gracias!
 
0
•••

We're social

Unstoppable Domains
Domain Recover
NameMaxi - Your Domain Has Buyers
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back