Solved

VBScript form variables

Posted on 2000-03-23
8
348 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
  • 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 

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 30 total points
ID: 2648643
value just use

Dim a
A = Text1.Value
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to solve this equation 3 53
Update function to validate checkbox is checked 4 74
SQL Filter Question 8 82
How to get statistic's from a competitors website?! 1 103
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…
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 Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

786 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