Solved

Call VBScript from HTML Button

Posted on 2008-06-17
3
4,300 Views
Last Modified: 2013-11-25
Hi Experts:

How do I call client side VBScript using an HTML button?

My application is PHP5, HTML,  MySQL  based running on WinXP Pro, SP2.  I'm using WAMP2 as my LAMP.  (http://www.wampserver.com/en/)

For the button Click event, I want to pass two values stored in HTML text fields to the VBScript.  Call them businessUnit and glAccount.  When the script finishes executing, I want to return a value  from the VBSCript to the HTML page and and place that value in a text field .  Call it returnStatus.   See Code Snippet below.

Please be sure to address the two pass variables and the one return variable.

Note, in the code snippet the text fields "value=" are PHP variables.

'Thanks much,
Cheers!
<input name="businessUnit" type="hidden" value="$bu" />

<input name="glAccount"    type="hidden" value="$glAccount" />
 

<input name="returnStatus" type="text" value="<?=$returnStatus?>" size="8" maxlength="8"/>

Open in new window

0
Comment
Question by:IT79637
  • 2
3 Comments
 
LVL 1

Author Comment

by:IT79637
Comment Utility
Upped point value to 500.
0
 
LVL 17

Accepted Solution

by:
gops1 earned 500 total points
Comment Utility
Is it something like this:


<html>

	<head>

		<title>Script Demo Gops</title>

		<script language="VBScript">

			Sub ProcessPayroll()

				Dim val1, val2
 

				val1 = int(Document.test.businessUnit.Value)

				val2 = int(Document.test.glAccount.Value)
 

				Document.test.returnStatus.Value=val1+val2

			End Sub
 

		</script>

</head>

<body>

	<form name="test">

		<input name="businessUnit" type="hidden" value="200" />

		<input name="glAccount"    type="hidden" value="300" />

		<input name="returnStatus" type="text" value="" size="8" maxlength="8"/>
 

		<br>

		<input type="button" value="Click Me" onClick="ProcessPayroll()">

	</form>

</body>

</html>

Open in new window

0
 
LVL 1

Author Closing Comment

by:IT79637
Comment Utility
Thanks much!!!
Cheers.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

The purpose of this article is to demonstrate how we can use conditional statements using Python.
This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

744 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now