View Full Version : Multiple Form actions in one page

08-14-2005, 09:22 AM
Ok, I am trying to modify a login page to use the username and password to run a stored procedure which returns the username and password for this specific application.

username + pass > sproc > appusername + apppass

So basically users don't have to remember multiple logins and can use one universal. I have this working, unfortunately, it is a 3 page process that requires multiple clicks.

The first page they enter their known user+pass, click submit
that passes the variables to a page that runs the sproc and returns the application specific user+pass and places them in HIDDEN textboxes. When they click submit again, it passes those to the actual login page where they must click submit yet again to enter the application.

Is there a better way of doing this? I was able to make this all one page/process with ASP.NET but the application I am passing to is Classic ASP and they don't play nice togather with variables.

Ideally, I'd like them to be able to enter their known username and password, click submit, which runs the sproc, returns the alternate credentials, and automatically POSTs those to the final page.

Please forgive my complete ignorance of old school VB ;)

08-14-2005, 06:28 PM

why do you dont save the login in session variables?

You have the login page, if login is correct you generate a Session variable like islogin = True.
Then you have access to your applications.


08-14-2005, 06:58 PM
you do not need to use multiple pages in classic asp. You can use sub procedures. Put each section into a different sub and call them individually just like you did in asp.net

08-15-2005, 04:07 AM
Cyberlord: Thanks, but the alternate ID is required to direct them to their account (so its not a yes/no situation). Good idea though

miranda: That sounds perfect... Now my question is:
What do I put in the form tag?
<form name="login" action=" ??? " method="post" ID="Form1">
In other words, how do I call the sub while passing the form variables to it.


08-15-2005, 02:02 PM
there is only 1 form tag. That has
action="<%=Request.ServerVariables("URL")%>" Now because Classic asp doesn't have a Page_Load event that you can use, you will need to look to see if the submit button was pressed. If not then the page is loading for the first time. If yes then the form was filled out and it is time to run the server side code. that may look like this

the button's html
<input type="submit" value="Submit" name="btnSubmit">

in the code

If Len(Request.Form("btnSubmit")) > 0 Then
' the button was submitted call your sub procedures
'the button wasn't submitted
'Call showForm() 'the sub procedure that shows the form
End If

08-15-2005, 08:46 PM
Thanks a bunch.
That worked out great and that's one less thorn in my side, and one more nugget of information.

08-15-2005, 08:58 PM
Glad to help.