Ok, so I know this is probably going to be a rather silly question, but as i stated in my last post i am very new at ASP.
I have taken some tutorials on on validating form input and have half-way succeeded. I have a rather extisive form and want to validate several things, but for the sake of simply learing how to do it right now i am only trying to validate the First Name (fname) portion of my form. I have made it to where it prevents the form from being sent and at the top of the page it prompts the person to fill it in, however it resets the entire form when it does, i would rather have a pop-up warning type prompt that will not reset the form. Is there a way to do this?
Here is the section of code, i think it will be all you need, i left out the HTML that is below it, and in case this is need-to-know information, the form is on the same page as this validation/mailer:
<%
if Request.Form("isSubmitted") = "yes" then
Dim fname, lname, email, adrs1, adrs2, city, hstate, zip, hphone, wphone, cphone, state, comm, weap, game
Dim Mail
Dim Validate_Form
fname = Trim(Replace(Request.Form("FName"),"""",""""""))
lname = Trim(Replace(Request.Form("LName"),"""",""""""))
email = Trim(Replace(Request.Form("Email"),"""",""""""))
adrs1 = Trim(Replace(Request.Form("Address1"),"""",""""""))
adrs2 = Request.Form("Address2")
city = Trim(Replace(Request.Form("City"),"""",""""""))
hstate = Trim(Replace(Request.Form("HState"),"""",""""""))
zip = Trim(Replace(Request.Form("Zip"),"""",""""""))
hphone = Trim(Replace(Request.Form("HomePhone"),"""",""""""))
wphone = Trim(Replace(Request.Form("WorkPhone"),"""",""""""))
cphone = Trim(Replace(Request.Form("CellPhone"),"""",""""""))
state = Trim(Replace(Request.Form("State"),"""",""""""))
comm = Request.Form("Comments")
weap = Request.Form("Weapon")
game = Request.Form("Game")
Validate_Form=true
if len(fname)<2 then
Validate_Form = false
end if
if not Validated_Form then
Response.Write "<p>Please click back on your browser and complete the following fields:</p>"
if fname<> "" then
else
Response.Write "<b>• First Name</b><br>"
end if
I actually have an updated version of that, this one validates several variables but still refreshes the page and resets the form when it does so, anyway, here is the code that i need modified. I would like to keep the same type format however, i want for it to list the things that were imporperly filled out, mabey it is possible to generate a html page pop-up?
<%
if Request.Form("isSubmitted") = "yes" then
Dim fname, lname, email, adrs1, adrs2, city, hstate, zip, hphone, wphone, cphone, state, comm, weap, game
Bookmarks