Solved

ASP question - A challenge for 200 points

Posted on 1998-10-17
5
152 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

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 …
It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

776 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