473,408 Members | 2,402 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

updating forms using ASP

Roo
Hi - apologies for ASP newbie question.

I have a form which has two fields, "details" and "score", the first
of which can be edited by the user and the second of which is hidden.
When "details" is updated, I need to update "score" and then call a
javascript routine to do some client-side calculations using "score".

I was going to use ASP to search a text file containing the
corresponding values (there are thousands) of "details" and "score",
and then return a value into the hidden "score" field in my form.

e.g.

<form name="stuff" action="">
Details: <input type="text" name="details" value=""
onchange="docalculation()">
<input type="hidden" name="score" value=0>
</form>
<script language="JavaScript" type="text/JavaScript">
function docalculation(){
var num = document.stuff.score.value;
num += 42;
alert("The answer is "+num);
}
</script>

Not sure how to call the ASP routine though and get it to return a new
value of score. Don't want to refresh the page and need the score to
automatically update whenever the details field is changed.

Thanks

Roo

Jun 11 '07 #1
2 1529
ASP runs on the server. If you want it to do something you must submit the page (refresh)

Alternatively, you could look into something like Ajax which pauses the page while it submits behind the scenes

http://en.wikipedia.org/wiki/Ajax_(programming)
"Roo" <r.*****@ed.ac.ukwrote in message news:11*********************@a26g2000pre.googlegro ups.com...
Hi - apologies for ASP newbie question.

I have a form which has two fields, "details" and "score", the first
of which can be edited by the user and the second of which is hidden.
When "details" is updated, I need to update "score" and then call a
javascript routine to do some client-side calculations using "score".

I was going to use ASP to search a text file containing the
corresponding values (there are thousands) of "details" and "score",
and then return a value into the hidden "score" field in my form.

e.g.

<form name="stuff" action="">
Details: <input type="text" name="details" value=""
onchange="docalculation()">
<input type="hidden" name="score" value=0>
</form>
<script language="JavaScript" type="text/JavaScript">
function docalculation(){
var num = document.stuff.score.value;
num += 42;
alert("The answer is "+num);
}
</script>

Not sure how to call the ASP routine though and get it to return a new
value of score. Don't want to refresh the page and need the score to
automatically update whenever the details field is changed.

Thanks

Roo

Jun 11 '07 #2
Roo <r.*****@ed.ac.ukwrote:
>Hi - apologies for ASP newbie question.

I have a form which has two fields, "details" and "score", the first
of which can be edited by the user and the second of which is hidden.
When "details" is updated, I need to update "score" and then call a
javascript routine to do some client-side calculations using "score".

I was going to use ASP to search a text file containing the
corresponding values (there are thousands) of "details" and "score",
and then return a value into the hidden "score" field in my form.

e.g.

<form name="stuff" action="">
Details: <input type="text" name="details" value=""
onchange="docalculation()">
<input type="hidden" name="score" value=0>
</form>
<script language="JavaScript" type="text/JavaScript">
function docalculation(){
var num = document.stuff.score.value;
num += 42;
alert("The answer is "+num);
}
</script>

Not sure how to call the ASP routine though and get it to return a new
value of score. Don't want to refresh the page and need the score to
automatically update whenever the details field is changed.
ASP runs on the server and generates an HTML page that's delivered to
the client. JavaScript (usually, and definitely in this case) runs on
the client after the ASP processing is finished. So you cannot call an
ASP routine from Javascript code, except by have the Javascript submit
the page or send an AJAX request to the server. You'll have to do one
of those two things to accomplish what you want.

--
Tim Slattery
MS MVP(DTS)
Sl********@bls.gov
http://members.cox.net/slatteryt
Jun 11 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: willow1480 | last post by:
I am developing a small little Service Control Application. I am using a listview control with checkboxes and getting the list of services I want to control from a text file. When you check a...
2
by: BG | last post by:
We're having trouble writing the code to update a UI control (label.Text) from a secondary thread. We're using C# with Windows Forms. We have a main form named MainForm, a splash screen form...
0
by: Chad | last post by:
Hello Everybody, I am trying to update a few textboxes automatically in vb.net. I have a timer updating the variables which are assigned to the textbox.text attribute, I would like to have the...
4
by: aaronyoung | last post by:
I have created custom navigation buttons and Record Number indicators on several forms that are used to review and update records based on a query. My On Current event to update the "Record X of...
1
by: jonbartlam | last post by:
Hi There I'm not sure what exactly is going wrong here. I'm writing an application that retreives a table from a database (tbl_internalfaults) and updates it. (Actually, just the status column will...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.