473,654 Members | 3,060 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2909
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.formNa me.a.value;
var b = document.formNa me.b.value;
if (a!='' && b!='') {
var c = Math.sqrt(Math. pow(a,2) + Math.pow(b,2));
if(!isNaN(c)) { document.formNa me.c.value=c; }
}
}
</script>

Ray at work

"Jack" <Ja**@discussio ns.microsoft.co m> wrote in message
news:4F******** *************** ***********@mic rosoft.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**@discussio ns.microsoft.co m> wrote in message
news:4F******** *************** ***********@mic rosoft.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**@discussio ns.microsoft.co m> wrote in message
news:4F******** *************** ***********@mic rosoft.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
3692
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 AmountApplied Funds Remaining
1
5387
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 i've tried a lot before posting. here's my situation. i have a simple form with dates on it. i have an indate and outdate
2
2019
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 problem is that the calculated fields are blank for a split second when the form opens, and then the value appears. This makes any tests fail. How can I test against these fields once the calculation has been done ?
1
2964
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 the following: =* The Subform Order fields are pulled from a Query along with each calculated Total. They are displyed in a DataSheet View. This works fine on my developement environment which includes a server set up just as our client has. ...
2
3249
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. Arrrgggghhhhhhhhhhhhhhhhhhhhhh.....etc and ahhh This should be simple, but... This is a report for a sales order. Parent report actually shows the header and detail, detail is not in the subreport. In the subreport is a breakup of committed product by UseBy date. ...
10
3912
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 SOL6M which adds 6 month to the date entered in the Occurence field, this is done with the following Controls: =DateAdd("yyyy",1,) =DateAdd("yyyy",2,) =DateAdd("m",6,) The problem is that the data in the SOL1, SOL2, and SOL6M does not show up...
2
5531
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 Form" in order to search for records based on this form, I would like to be able to enter a value in this "days" control so that I can filter records on the form based on this calculated interval (i.e., i want to search for records specifically where...
9
7807
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 value of 12,527.75 in it. Brokerage Due field is the calculated field which multiplies a factor
1
2005
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 handicap), i.e. 3 fields per line in the subform showing date, score, handicap. The handicap needs to be calculated in VBA code as it is fairly complex to work out and depends on previous scores as well as the current score. I can get a query to...
0
8379
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8294
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8816
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8494
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8596
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2719
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1924
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1597
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.