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 9, 1999

Using ASP and VBScript

Question:
I am developing an application using VBScript and ASP. I wrote this HTML code to be executed on a client's machine:


  
    

The user will enter the name of customer in the first text box. When the user clicks the Submit button, I want to display the age of the customer in another text box on the same HTML form. The code required to search for the customer and obtaining the age is written in the "server.asp" file located on my server (I am using Personal Web Server). The code works, but I do not know how to get the data (age of the customer) from the server back to the current HTML form running on the client machine.

If there is no way to do this with ASP and VBScript, can you suggest something else?

Answer:

Once your visitor hits the Submit button, the form no longer exists on the client machine, so you can't send the data back to the instance of the form on the screen.

However, you can send back the previous page, by filling in the text box with the proper value. Assuming that you have the answer for the age in your variable intAge, your server.asp page should "response.write" out the original HTML. Just replace the txtAge text box line with the line:


">

Another option is to send the HTML form back as it was, moving it above the form or somewhere else. You could send the answers like this:


Customer Name: <%= Request("txtName") %>

Age: <%= intAge %>

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