Solved

ASP question - A challenge for 200 points

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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
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 create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

705 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