CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Summing up fields prior to submitting form

Print topic Send  topic

Author Message
gmarkwood

Posts: 10
Posted: 01/25/2004, 7:02 PM

I would like to sum up a series of fields on my form with a button to see a total prior to committing to the DB.

Something like this: Page.ControlName.Value = (Page.ControlName1.value + Page.ControlName2.value) This would be code under a Button, with action "On Click".

I would like to sum up some fees for services and have it totaled prior to submiting to the DB. I have 12 fields on the page that needs summing and a field that would show the total.

Currently I have a field that shows the Summation on a second page after submitting with the code: Session("Var") = (Page.ControlName1.value + Page.ControlName2.value). I am passing a session variable to a field on the second page to show the sum, with a button that will go to the previous page to edit the values.

I must be missing something, this sounds simple to me, but I am not getting it /mw
View profile  Send private message
DonB
Posted: 01/25/2004, 8:14 PM

Summing the fields would be a client-side action, not a server event. So
the Server OnClick event won't help.

It sounds like you want a "live" update of the display as the user enters
data. That would require javascript in the "onchange" event of the input
fields to trigger a recalculation of the sum.

Be sure you are clear about what occurs on the server side and what occurs
on the client side. Otherwise, you will be writing code in event handlers
that will not execute until the form gets submitted and you will not have
the behavior you expected. All the ASP code executes on the server.

--
DonB

http://www.gotodon.com/ccbth


"gmarkwood" <gmarkwood@forum.codecharge> wrote in message
news:64014835a6ea33@news.codecharge.com...
> I would like to sum up a series of fields on my form with a button to see
a total prior to committing to the DB.
>
> Something like this: Page.ControlName.Value = (Page.ControlName1.value +
Page.ControlName2.value) This would be code under a Button, with action "On
Click".
>
> I would like to sum up some fees for services and have it totaled prior to
submiting to the DB. I have 12 fields on the page that needs summing and a
field that would show the total.
>
> Currently I have a field that shows the Summation on a second page after
submitting with the code: Session("Var") = (Page.ControlName1.value +
Page.ControlName2.value). I am passing a session variable to a field on the
second page to show the sum, with a button that will go to the previous page
to edit the values.
>
> I must be missing something, this sounds simple to me, but I am not
getting it /mw
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

peterr


Posts: 5971
Posted: 01/25/2004, 9:31 PM

Just to expand on Don's information, see:
http://www.google.com/search?q=javascript+sum+form+fields
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.