Solved

ASP question - A challenge for 200 points

Posted on 1998-10-17
5
150 Views
Last Modified: 2013-12-25
Hi,
How can a active serverpage take the value of a variable declared in Javascript or the value of the <input type> tag of an HTML tag.
The problem is that I have a variable decalared In ASP and I want that variable to have the value of a variable declared in javascript.If this is not possible at least if it is possible to have the ASP variable have the value contained in a <input type> tag.I do not want to submit my form.If it is submitted I know how to access the form elements.

It will be greatly appreciated if you give me the answer in 2 days time.

Thank you,

Zeus
0
Comment
Question by:zeus_akkali
  • 3
5 Comments
 
LVL 28

Accepted Solution

by:
sybe earned 200 total points
ID: 1829152
ASP variables are server-side
browser-Javascript variables are client side

So the variables are on different computers.

To transfer client side variables to the server, you have to do a form-submit. There is no other way !

There are ways to "hide" the form-submit, like submitting to a hidden frame.

0
 
LVL 28

Expert Comment

by:sybe
ID: 1829153
By the way, why should you want to change a serverside variable without doing a form-submission. Because the same problem appears then: to get a server-side variable back to the client, the client has to do a request for a new page. Submitting a form is one of the ways to do a request.

I do not know what you want to solve in terms of user-interface, describe that problem, maybe there's another way to solve it.
0
 
LVL 1

Author Comment

by:zeus_akkali
ID: 1829154
What I want to do is have a save button in the page and when one clicks on it.He is able to save it without showing another page.So I need to have the value of the HTML tags so that I can save the value into the database in the server.I do not want another page to be displayed.Can you tell me a way to do this?

Hoping for an early reply.

Thank You,

Zeus
0
 

Expert Comment

by:narula
ID: 1829155
You can accomplish what you desire by using Microsoft's RDS technology.  However, I don't recommend it if you're looking for a cross browser solution.

If all you want to do is save the contents and redisplay them in the form field, why don't you just use the same page to do this?  Set the FORM's ACTION attribute to the same path/page.  Then insert script above the form to process the value of your fields (save to db or whatever) and then redisplay the data by dumping the previously submitted form field values into the current HTML that you will generate.  Granted, the page will have to reload, but this is the price of web apps.

-Ankush
0
 
LVL 28

Expert Comment

by:sybe
ID: 1829156
Ok, make a "hidden" frame:

<frameset rows="0,*" border=0 frameborder=0 framespacing=0>
 <frame src="empty.asp" name="hidden">
 <frame src="yourform.asp" name="main">
</frameset>

Now you have an invisible frame (Netscape shows a one-pixel frame). In the main page, submit your form to the hidden frame:

<form action="..." TARGET="hidden">

</form>

When the form is submitted, there is no visual change in the browser, the response returns to the hidden frame.

There is one user-problem: how will the user know that his/her form is saved.

You can solve that by making an javascript-alert in the response-page (which appears in the hidden frame). If everything is saved then:

<script>alert('ok')</script>

0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Ever wondered how to display how many visitors you have online. In this tutorial I will show you an easy but effective way to display the number of online visitors in WhizBase. In this article I assume you have read my previous articles and know …
This tutorial will discuss the log-in process using WhizBase. In this article I assume you already know HTML. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you might look at some of my other articles abo…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

744 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

12 Experts available now in Live!

Get 1:1 Help Now