Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Active Server Pages (ASP)
Expertise: Beginner
Jul 7, 1999

Reading Across Mulitple Forms on One ASP Page

Question:

I have two forms on my ASP page. The first form uses the &qoutPost" Method and second uses the &qoutGet" Method. The form using the "Get" method has a textbox with a value. How can I get the "Post" form to read the value of textbox in the "Get" form?

Answer:

When your form is submitted, it cannot view any information from the other form. Only the form that is being submitted sends its values over.

However, using client side Javascript, you can make sure that form1 sends form2's textbox value when it is submitted.

In the form tag, include the code:

... your form contents

Assume you have defined the second form with a name of "form2" and it has a text box called "text1". Use the following Javascript code anywhere on your page, preferably in the section.


In your "Whatever" ASP page that responds to the POST form's submit action, you can read the value of the form's variables by using:

   var = Request("variablename")

The value of the other text box will now be available as:

var = Request("OtherTextBox")
DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date