navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

Quick question on submitting forms with ASP

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> Quick question on submitting forms with ASP
Page: [1]
 
womble

 

Posts: 5594
Joined: 3/14/2005
From: Living on the edge
Status: offline

 
Quick question on submitting forms with ASP - 7/23/2006 15:22:43   
I have a form that I need to submit the responses to to a text file, but I also need to validate the form input. (it's for a course I'm doing). My VbScript/ASP skills are not great and I know I've not done half of it 'properly' - current strategy is to just get anything that sort of works like it should submitted (yep, Wombly in panic mode). I've done the submitting to the text file, but I'm struggling to work out how to get the validation into the same script. Then I had an idea, I'm thinking that I could do the validation script so that if all the fields validate, then it triggers the second script. Something like:

1st SCRIPT HERE
....
If Form_Valid = "false" Then
response.redirect "formpage.asp"
Else
If Form_Valid = "true" Then
response.redirect "secondscript.asp" <-- url of second script here which submits the form then redirects to the success page

Would something like that work in theory or am I way off here?

_____________________________

~~ "A cruel god ain't no god at all" ~~
:)
rdouglass

 

Posts: 9265
From: Biddeford, ME USA
Status: offline

 
RE: Quick question on submitting forms with ASP - 7/23/2006 15:47:10   
quote:

I also need to validate the form input.


Is this something you can do Clientside with JavaScript?

I do that often with various Javascripts. One I change the 'action' of the form tag on the fly. What is it you hope to accomplish if the form does not validate?

Or maybe you want to do it all in ASP. If so, you may not want to bother with the redirects; you should be able to run most scripts directly if you choose:

If Form_Valid = "false" Then
'run the script directly
Else
'run the second script hereand then redirect to the success page
End If

I wish I knew more which direction you want to take this. As with most projects, there are many ways to do the little things but when you start looking at the bigger picture, some methods work better than others.

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to womble)
womble

 

Posts: 5594
Joined: 3/14/2005
From: Living on the edge
Status: offline

 
RE: Quick question on submitting forms with ASP - 7/23/2006 16:38:06   
Normally I would do it client-side with JavaScript (or more usually PHP), but this has to be done in ASP (grrr!). That's a help though - thanks. :)

_____________________________

~~ "A cruel god ain't no god at all" ~~
:)

(in reply to rdouglass)
Spooky

 

Posts: 26603
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Quick question on submitting forms with ASP - 7/23/2006 16:51:57   
The typical logic I use for processing forms on the same page is this :

<%
Request all form values

If form values populated (form has been submitted) .. then
Check validation
If validation fails, do nothing
else
Submit form values to text file, redirect to success page
end if
Else
Form values not submitted, first visit
End if
%>


If validation fails, you continue to display the form page.
However, you now have the previously submitted values set as variables.
You populate the form inputs with these values and highlight the error






_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to womble)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> Quick question on submitting forms with ASP
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts