?
Solved

ASP question - A challenge for 200 points

Posted on 1998-10-17
5
Medium Priority
?
157 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 28

Accepted Solution

by:
sybe earned 400 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses

764 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