Solved

VBScript form variables

Posted on 2000-03-23
8
350 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

839 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