[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

JavaScript calling database using ASP/VBScript

Posted on 2001-07-31
7
Medium Priority
?
196 Views
Last Modified: 2008-02-01
I want to use an onSubmit to check a database, and open a pop-up to collect a password if necessary.

Opening the pop-up is obviously easy- but how do I get the javaScript function to execute the VBScript and connect to the database.

Basically the flow is as follows:

1.  User enters a userName
2.  On clicking the Submit button the javaScript function checks the database.
3.  If the userName belongs to a registered user, the function opens a pop-up prompting for the associated password.
4.  On Submitting the password in the pop-up, the function then checks the password against the userName in the database.
5.  If the password is a match the javaScript then redirects to the next page.
0
Comment
Question by:russoffl
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 1

Author Comment

by:russoffl
ID: 6337914
I guess as an alternative, once Page 1 has collected the userName, and the form (Submit) hands the data to Page 2, I could use an onLoad method to do the userName lookup.

The issue - or problem still remains - How do I execute VBScript/ASP code from within the javaScript.
0
 
LVL 5

Accepted Solution

by:
raizon earned 150 total points
ID: 6337916
You have the server look for the form to be filled.  If it is then you connect to the database and check the password and username.

<%

If NOT IsEmpty(Request.Form("UserName")) And IsEmpty(Request.Form("Password")) Then

'Connect to database

Else

'Redirect to fill out all fields

End If


%>
0
 
LVL 1

Author Comment

by:russoffl
ID: 6338131
The application lends itself better to a javaScript method of validation.  Most javaScript validation script use cgi - I need to stick to ASP/VBScript.  So the problem is allowing the JavaScript to execute the ASP code.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 5

Expert Comment

by:raizon
ID: 6338195
Understood.

The code I posted doesn't necessarily validate the form but rather is a way of testing to see if the form was posted then executing the ASP code if returned True.

Since the JavaScript is running on the client side there is no way for it to execute the ASP code until the control has been passed back to the server such as posting the form.
0
 
LVL 1

Author Comment

by:russoffl
ID: 6339215
I understand that you cannot get client side to execute server side scripts without recalling the page, or calling another page.  I was hoping that there was a way for JavaScript to execute server side / database selects.

Since a pop-up is a page, I guess I could get the JavaScript to execute server side scripts by opening a new window/pop-up, passing a value from the original page to the pop-up.  The pop-up's ASP/VBScripts could then do the database call.  JavaScript in the pop-up could then pass the "verified" or "failed" back to JavaScript in the parent window.

Just have to figure the JavaScript code out.

0
 
LVL 5

Expert Comment

by:raizon
ID: 6341174
Try this

<body onload="self.opener.document.location='main.asp?success=<%=  strSuccess %>'; window.close()">

Then in the ASP set the variable strSuccess to either verified or failed depending on the output.

0
 
LVL 5

Expert Comment

by:raizon
ID: 6377685
thanks for the points.  :-)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question