NetTalk Central

Author Topic: How to calculate the total in a form in real time  (Read 6078 times)

Robert Iliuta

  • Sr. Member
  • ****
  • Posts: 472
    • View Profile
    • Email
How to calculate the total in a form in real time
« on: April 12, 2011, 12:13:34 AM »
Hallo,


In a form I need to do some calculations in real time. When the user enter the value I would like to update the total on the same time. How it is possible? Which embed?

Regards,
Robert

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: How to calculate the total in a form in real time
« Reply #1 on: April 12, 2011, 12:58:22 AM »
Robert,

hmm - you know how to do this.

a) set Hide settings for dependent field based on SessionValue of the "parent" entry field.
b) add the "dependent" to the reset list on the client side tab of the "parent" entry field.

Cheers
Bruce

Robert Iliuta

  • Sr. Member
  • ****
  • Posts: 472
    • View Profile
    • Email
Re: How to calculate the total in a form in real time
« Reply #2 on: April 12, 2011, 01:35:07 AM »
Hallo Bruce,


I know how to to this, the questions was how to do in real time! On the same time when I enter the value I want to calculate the total.... Now it calculate after user press tab key or select with mouse another field. I need to refresh the total every time user write or delete a value.
On desktop app I use Event:NewSelection for this.
I do something wrong or it's possible only when press tab key or move the mouse on another field?

Thank you,
Robert

charl99

  • Full Member
  • ***
  • Posts: 185
    • View Profile
    • Email
Re: How to calculate the total in a form in real time
« Reply #3 on: April 12, 2011, 01:59:47 AM »
Hi Robert,

Look at example 34, Calculator.  If you want to do what you want to do, you must use something like the button tab so you can send some server side code each time something change (or is pressed).

Cheers
Charl

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: How to calculate the total in a form in real time
« Reply #4 on: April 12, 2011, 04:20:19 AM »
Hi Robert,

It can be done using JavaScript - but it could get a bit icky if one isn't careful.
I would need to add code to make it reasonably simple.

But - although it sounds good - it'll mean a lot of extra network traffic - I'm not sure it's such a good idea. What sort of thing are you wanting to use it for?

cheers
Bruce


jorgemir

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
    • Email
Re: How to calculate the total in a form in real time
« Reply #5 on: May 09, 2011, 01:18:41 PM »

>>It can be done using JavaScript - but it could get a bit icky if one isn't careful.
>>I would need to add code to make it reasonably simple.

Has this item be into your agenda? It is very important for the user view side. I need to get the totals on the form calculated before send it.
Thanks.
Jorge

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: How to calculate the total in a form in real time
« Reply #6 on: May 09, 2011, 10:06:34 PM »
Hi Jorge,

I haven't added it to the list yet, because the exact implementation depends a bit on my question;

>> What sort of thing are you wanting to use it for?

Cheers
Bruce

jorgemir

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
    • Email
Re: How to calculate the total in a form in real time
« Reply #7 on: May 10, 2011, 11:01:52 AM »
For example, in a sales form, I need to show the total of quantity * price before the user accepts and save. eip enabled browse must show the totaling field updated when user does an input.

I see no problem with forms, as the value can bu updated with embed, but i can not get this precise behavior with browse totaling.

Thanks
Jorge

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: How to calculate the total in a form in real time
« Reply #8 on: May 11, 2011, 04:39:27 AM »
Hi Jorge,

But surely you'll only update the total when they complete the field?
I mean, you won't wait for them to press "submit" - but you would update the total 3 times as he types
123
right?

jorgemir

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
    • Email
Re: How to calculate the total in a form in real time
« Reply #9 on: May 11, 2011, 10:06:21 AM »
This form has  the quantity, Price and total, Then the user has to select some other stuff, like flavors and sizes. It would be precious to get the total updated as soon as the user clicks or select other fields, most benefit is the sense of response.
Second point is more important, the totalling field of the browse is not updated until I reload the frame, which is ugly for the use, specially when the form is a popup.

Thanks
Jorge