Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

VBScript form variables

Posted on 2000-03-23
8
Medium Priority
?
368 Views
Last Modified: 2012-06-21
Scenario:

I have a form with 5 fields. When I click on a button, I need a VBScript that stores all the values in the form fields in respective variables. I need to use these variables in a procedure.

How can I set variables to the form field values??
0
Comment
Question by:thatcoolguyAK
[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
8 Comments
 
LVL 4

Expert Comment

by:CoolAss
ID: 2648265
make the action of your form:

ACTION="process.asp" METHOD="POST"

Now this is the process.asp

Var1 = Request.Form("inputname1")
Var2 = Request.Form("inputname2")
Var3 = Request.Form("inputname3")
Var4 = Request.Form("inputname4")
Var5 = Request.Form("inputname5")

Now call your procedure with those variables. This assumes that your page with the form has the text boxes named inputname1, etc...

0
 

Author Comment

by:thatcoolguyAK
ID: 2648312
Adjusted points from 20 to 30
0
 

Author Comment

by:thatcoolguyAK
ID: 2648313
I dont want to post the variables to another form. I'd rather use an event that looks at all the fields of the page and picks up their values
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:thatcoolguyAK
ID: 2648324
I dont want to post the variables to another form. I'd rather use an event that looks at all the fields of the page and picks up their values
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 2648592
Use the onclick event.

You have a form with a name. And all the option / input boxes etc. have a name too. Then when the user clicks a button you do

<input type=button onclick="javascript:IsClicked()">

The javascript function will look like:

function IsClicked()
{
        value1=formname.formitem.value;
        ...
        return false;
}

Only use return false if you don't want the page to reload.


0
 

Author Comment

by:thatcoolguyAK
ID: 2648603
I need it to be VEEE BEEEE Script mate.
Not JavaScript
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 2648641
Oh.VEEEEEEBEEEEEEE =)

Mate, here ya go...this should help you

<HTML>
<HEAD><TITLE>Simple Validation</TITLE>
<SCRIPT LANGUAGE="VBScript">
<!--
Sub Button1_OnClick
  Dim TheForm
  Set TheForm = Document.ValidForm
  If IsNumeric(TheForm.Text1.Value) Then
    If TheForm.Text1.Value < 1 Or TheForm.Text1.Value > 10 Then
      MsgBox "Please enter a number between 1 and 10."
    Else
      MsgBox "Thank you."
    End If
  Else
    MsgBox "Please enter a numeric value."
  End If
End Sub
-->
</SCRIPT>
</HEAD>
<BODY>
<H3>Simple Validation</H3><HR>
<FORM NAME="ValidForm">
Enter a value between 1 and 10:
<INPUT NAME="Text1" TYPE="TEXT" SIZE="2">
<INPUT NAME="Button1" TYPE="BUTTON" VALUE="Submit">
</FORM>
</BODY>
</HTML>

0
 
LVL 22

Accepted Solution

by:
CJ_S earned 60 total points
ID: 2648643
value just use

Dim a
A = Text1.Value
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

730 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