Solved

ASP question - A challenge for 200 points

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
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 how to look for a specific file type in a local or remote server directory using PHP.

867 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

16 Experts available now in Live!

Get 1:1 Help Now