Dynadot .com transfer sale, only $10.12 with coupon code DYNA12, available while supplies last, ends October 31, 2026.

ASP-form validation

SpaceshipSpaceship
SpaceshipSpaceship
SpaceshipSpaceship
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.
GoDaddyGoDaddy
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
•••
CatchedCatched

We're social

Escrow.com
Spaceship
Escrowly
CryptoExchange.com
Domain Recover

NamePros updates

New in Parking: updated way to act on many domains or inquiries at once
Your domain list and inquiry list now have a bar above and below the list. Check the items you want, then choose an action in the bar...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back