Solved

VBScript form variables

Posted on 2000-03-23
8
344 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
 

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
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!

 
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

760 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

22 Experts available now in Live!

Get 1:1 Help Now