473,396 Members | 2,002 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,396 software developers and data experts.

Showing Calculated fields in the form

Hi,
I have a asp input form of a financial report. Here most of the fields are
text boxes where the user need to input the values corresponding to an item.
However, there are few items which are calcuated field. Prior to submission
of the information, I would like the user to know what the calculated field
be (based on the information input in text boxes) before submission of the
form. Is there any way to display the calculated value before submission in
ASP? I appreciate in any help. Thanks.
Jul 22 '05 #1
3 2879
If you want to do it ~before~ submission, you'll need to use client-side
script to calculate the values, i.e. JavaScript, which is off-topic here of
course. But, as a sample:

<form name="formName">
<input name="a" type="text" onchange="hyp();" />
<input name="b" type="text" onchange="hyp();" />
<input name="c" type="text" />

</form>
<script type="text/javascript">
function hyp() {
var a = document.formName.a.value;
var b = document.formName.b.value;
if (a!='' && b!='') {
var c = Math.sqrt(Math.pow(a,2) + Math.pow(b,2));
if(!isNaN(c)) { document.formName.c.value=c; }
}
}
</script>

Ray at work

"Jack" <Ja**@discussions.microsoft.com> wrote in message
news:4F**********************************@microsof t.com...
Hi,
I have a asp input form of a financial report. Here most of the fields are
text boxes where the user need to input the values corresponding to an item. However, there are few items which are calcuated field. Prior to submission of the information, I would like the user to know what the calculated field be (based on the information input in text boxes) before submission of the
form. Is there any way to display the calculated value before submission in ASP? I appreciate in any help. Thanks.

Jul 22 '05 #2
or you could:

assuming that let's say totvalue = txtbox2 + txtbox1

on updating either txtbox2 or txtbox1 call another asp page passing the two
vars and adding them up in that page and then
passing the three vars back into your original page.

txtbox1 would then be the var1
txtbox2 would then be the var2

and

in the html show the totvalue wherever you want to show it.

also,
at the start of the page have, if var1= "" then | var1=0 | end if
similarly for var2

using this method your data is more secure as all the calcs are done on the
server.

mirzai

"Jack" <Ja**@discussions.microsoft.com> wrote in message
news:4F**********************************@microsof t.com...
Hi,
I have a asp input form of a financial report. Here most of the fields are
text boxes where the user need to input the values corresponding to an
item.
However, there are few items which are calcuated field. Prior to
submission
of the information, I would like the user to know what the calculated
field
be (based on the information input in text boxes) before submission of the
form. Is there any way to display the calculated value before submission
in
ASP? I appreciate in any help. Thanks.

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.815 / Virus Database: 554 - Release Date: 14/12/2004
Jul 22 '05 #3
Thanks to both Ray and Mirza for giving insight to the resolution of problem.
I need to do a test page to check on the above two concepts before
implementing in the finalcial application. Regards.

"mirza i" wrote:
or you could:

assuming that let's say totvalue = txtbox2 + txtbox1

on updating either txtbox2 or txtbox1 call another asp page passing the two
vars and adding them up in that page and then
passing the three vars back into your original page.

txtbox1 would then be the var1
txtbox2 would then be the var2

and

in the html show the totvalue wherever you want to show it.

also,
at the start of the page have, if var1= "" then | var1=0 | end if
similarly for var2

using this method your data is more secure as all the calcs are done on the
server.

mirzai

"Jack" <Ja**@discussions.microsoft.com> wrote in message
news:4F**********************************@microsof t.com...
Hi,
I have a asp input form of a financial report. Here most of the fields are
text boxes where the user need to input the values corresponding to an
item.
However, there are few items which are calcuated field. Prior to
submission
of the information, I would like the user to know what the calculated
field
be (based on the information input in text boxes) before submission of the
form. Is there any way to display the calculated value before submission
in
ASP? I appreciate in any help. Thanks.

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.815 / Virus Database: 554 - Release Date: 14/12/2004

Jul 22 '05 #4

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

Similar topics

3
by: Anonymous | last post by:
Hi all, I have a form people use to enter checking data. One of the fields is calculated based on finding the difference of two input fields on the form. Here are the fields: CheckAmount...
1
by: Miguelito Bain | last post by:
hi everybody. i'm trying to find out what you can and can't do with/in calculated fields. any help, pointers, and/or advice would be greatly appreciated. i'm a newbie, but i want to learn, and...
2
by: david | last post by:
Hi, I have a form with a couple of calculated fields. I want to put some code into the 'Form-Load' event to set various object states on the form, depending on the value of these fields. The...
1
by: tconway | last post by:
I have an Access program that displays Customer data into a form and OrderID data into a subform. The totals in the Subform are based on calculated fields, i.e. the Total Amount field Calculates...
2
by: Jeff | last post by:
Damn this is frustrating. I have used subreports for years and never had this problem. I have used these things more times than I can remember. Never have I had this problem....
10
Cyberdyne
by: Cyberdyne | last post by:
Here is the problem, I have a form with a field named Occurence with a Short Date Value, once entered it subsequently appears in 3 fields SOL1 which adds one year, SOL2 which adds 2 years and...
2
by: jcf378 | last post by:
hi all. I have a form which contains a calculated control ("days") that outputs the # of days between two dates (DateDiff command between the fields and ). However, when I click "Filter by...
9
by: Haas C | last post by:
Hi all! Is there anyway I can override a value in a calculated field on a form? For example: I have a form which displays the following fields based on a query: Premium Due field has the...
1
by: Colin Clark | last post by:
Hello, I have a database of scores for a sports club. I want to display a continuous subform showing a person's scores for the season along with a running calculation based on those scores (the...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.