2

I'm having some trouble understanding the calculations aspect of my form. I'm looking to have various options (check boxes) add up dollar amounts that will be displayed as a single number at the bottom of the form, but I can't seem to figure out how to assign these dollar amounts to the various check boxes, or how to assign them past selecting the title of the entire option field, which to my knowledge doesn't do anything currently.

1

First off, I am a developer for Cognito Forms.

Just to clarify, you want to show a set of checkboxes, with assigned prices, and calculate the amounts as a total for the form, something like this:

Order Form Example

If you want to manually calculate a total based on the selections, you can use the following calculation (which is tricky, btw):

=Choice.Count(it = "First Choice") * 1.00 + Choice.Count(it = "Second Choice") * 2.00 + Choice.Count(it = "Third Choice") * 3.00

However, this is definitely not obvious, nor easy, so we have been working to makes things better. In the next release, which is currently in testing, you can configure choice fields as follows:

Order Form Choices

By selecting Collect Payment For This Field, you can then specify prices for each choice. These selections automatically add to the amount due and optionally can appear as separate order line items. This release will also support tightly integrated Stripe payment, so the order form example above would become:

enter image description here

Hopefully, these changes will support your needs and make things much easier!

  • This was totally helpful, thank you very much!! I was able to create a working form with this information, but I have one field that I'd like to make a "Drop Down" and the code you supplied works only when everything is a "Checkbox" is there a different word I should use for the Drop Down items? Thanks again! – Matt B Aug 17 '14 at 4:03
  • With Drop Down and Radio Buttons it is a bit easier, since they represent just a single selection. Just use a formula like =Choice = "First" ? 1.00 : Choice = "Second" ? 2.00 : Choice = "Three" ? 3.00 : 0.00. This syntax compares the value of the field to different options and returns the desired value. The specific syntax of condition ? true value : false value is called a ternary operator and is common in C languages and covered in our documentation, but can be confusing for complex cases like this. – Jamie Thomas Aug 20 '14 at 2:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.