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, 6 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, 6 months ago by . Reason: Changed title to include [SOLVED]

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

PS. My form is a QuickMode form.
  • DavidLGCrawford

Re: Checkbox values need to be summed 2 years, 6 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, 6 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, 6 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, 6 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.43 seconds

Facebook Discount - 40% Off!

Fans of our Facebook page here are entitled to get a 1-year-subscription for the price of a 6-months!

Steps to take:

  • Become a fan on Facebook (Like) here
  • Purchase a 6-months-subscription from here
  • Write a quick email to This email address is being protected from spambots. You need JavaScript enabled to view it. with your username and prove of your like and we'll upgrade to the 1-year-subscription

Joomla!® Forms Discount - 40% Off!

Already purchased a forms extension from a different vendor but your requirements changed and now you need a forms extension that is capable of more than just the standards? We help you to keep the costs for a change under control: Get a 40% discount on our professional membership plan! -- meaning timely unlimited access to all current and future commercial extensions, breezingforms themes & apps and Joomla!® templates at crosstec.de, including 1 year of support -- without any website limitations -- Just prove that you previously purchased another forms extension for Joomla!® from a different vendor and you are qualified.

Steps to take:

  • Purchase a 1-year-subscription from here
  • Write a quick email to This email address is being protected from spambots. You need JavaScript enabled to view it. with your username and prove of the purchase for the other form vendor and we'll upgrade to the professional-subscription

About

Crosstec GmbH & Co. KG

Bergisch-Gladbacher-Str. 829

51069 Cologne, Germany

Imprint