Welcome, Guest

[SOLVED] Checkbox values need to be summed
(1 viewing) (1) Guest

TOPIC: [SOLVED] Checkbox values need to be summed

[SOLVED] Checkbox values need to be summed 2 years, 3 months ago #9766

I'm using 1.6.5 Trinity (build 725)

I've got a form with 8 checkboxes.

For simplicity, we'll give them names cb1 through cb8.

The values in the checkboxes range from 35.00 to 70.00.

At the bottom of the form, I have a field called "amountOwing".

What I need is when a person clicks a checkbox on, the value of it is added to the amountOwing field at the bottom. Likewise, un-checking it will remove the amount.

Any help would be greatly appreciated.
  • DavidLGCrawford
Last Edit: 2 years, 2 months ago by . Reason: Changed title to include [SOLVED]

Re: Checkbox values need to be summed 2 years, 3 months ago #9767

PS. My form is a QuickMode form.
  • DavidLGCrawford

Re: Checkbox values need to be summed 2 years, 3 months ago #9785

Hi,

you can use the summarize item for that. Did you check this?
vimeo.com/5705515
===============================================
Satisfied?
Consider a membership!
===============================================
Like us on Facebook
===============================================
Follow us on Twitter
===============================================

Re: Checkbox values need to be summed 2 years, 3 months ago #9798

Okay, two problems with the summarize.

1. I can only get it to work if I put the summarize on a second page. I wanted my form to be a single page. Not major, because I can work with multi-pages... just would have preferred a single.

2. If one of the checkboxes is not checked then the summarize treats it as not a zero. This leads to errors in the addition.
For example:
cb1 = 10, cb2 = 20, cb3 = 30, cb4 = 40
If I check on cb1 & cb2, I get 30. That's correct.
But if I check on cb1, cb2, and cb4, I get 3040 and not 70. It counts the unchecked cb3 as a non-number, and then concatenates instead of adding.


PS. If the first checkbox is not checked then the summarize function always returns "not available" irregardless of the other checkboxes. I found a way around this by placing a hidden field called "zero", and setting it's value to 0. Now the summarize connects with "zero", and then adds on the values of the checkboxes.
  • DavidLGCrawford

Re: Checkbox values need to be summed 2 years, 3 months ago #9799

Hi,

1. There is a way but it requires some work, if you can live with a summary page, then it will be the easiest.

2. I suggest you add a zero as standard value and also put the "ff_integer" (or ff_real) validation on that field.
If the user leaves it accidentally empty or mistypes the value, the nextpage button will trigger the validation automatically and remind him of that issue.
===============================================
Satisfied?
Consider a membership!
===============================================
Like us on Facebook
===============================================
Follow us on Twitter
===============================================

Re: Checkbox values need to be summed 2 years, 3 months ago #9808

TheMuffinMan wrote:

2. I suggest you add a zero as standard value and also put the "ff_integer" (or ff_real) validation on that field.
If the user leaves it accidentally empty or mistypes the value, the nextpage button will trigger the validation automatically and remind him of that issue.



It's a checkbox field....
  • DavidLGCrawford
Moderators: TheMuffinMan, ForumSupport
Time to create page: 0.32 seconds

About

Crosstec GmbH & Co. KG

Bergisch-Gladbacher-Str. 829

51069 Cologne, Germany