[SOLVED] Checkbox values need to be summed - Crosstec
Welcome, Guest
Please Login or Register.    Lost Password?

[SOLVED] Checkbox values need to be summed
(1 viewing) (1) Guest
Go to bottomPage: 1234
TOPIC: [SOLVED] Checkbox values need to be summed
#9766
[SOLVED] Checkbox values need to be summed 10 Months, 1 Week ago Karma: 1
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
Fresh Boarder
Posts: 10
graphgraph
User Offline Click here to see the profile of this user
Last Edit: 2009/11/08 03:55 By DavidLGCrawford.Reason: Changed title to include [SOLVED]
The administrator has disabled public write access.
 
#9767
Re: Checkbox values need to be summed 10 Months, 1 Week ago Karma: 1
PS. My form is a QuickMode form.
DavidLGCrawford
Fresh Boarder
Posts: 10
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#9785
Re: Checkbox values need to be summed 10 Months, 1 Week ago Karma: 16
Hi,

you can use the summarize item for that. Did you check this?
vimeo.com/5705515
TheMuffinMan
Moderator
Posts: 769
graph
User Offline Click here to see the profile of this user
178152063 Gender: Male koelnkalk Location: Cologne - Germany Birthday: 03/07
The administrator has disabled public write access.
 
#9798
Re: Checkbox values need to be summed 10 Months, 1 Week ago Karma: 1
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
Fresh Boarder
Posts: 10
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#9799
Re: Checkbox values need to be summed 10 Months, 1 Week ago Karma: 16
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.
TheMuffinMan
Moderator
Posts: 769
graph
User Offline Click here to see the profile of this user
178152063 Gender: Male koelnkalk Location: Cologne - Germany Birthday: 03/07
The administrator has disabled public write access.
 
#9808
Re: Checkbox values need to be summed 10 Months, 1 Week ago Karma: 1
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
Fresh Boarder
Posts: 10
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
Go to topPage: 1234
Moderators: , TheMuffinMan