A lot of Formstack customers use our platform to create product/service order forms or event registration forms. When you get into adding values to fields and calculations, it can get a little tricky. First, let’s lay out the different fields you can add values or amounts/prices to so we know what we have to work with:?
Short Answer Field: as a default value
Number Field: as a default value
Select List Field: as an option value
Radio Button Field: as an option value?
Checkbox Field: as an option value
As shown in the first picture above, for a Short Answer or Number field, you will need to add the value to the default value box in the editor. If you want to display/produce a number based on the calculation of other fields with assigned values, you can do that too. I’ll lay that out further down!
Short Answer Fields
You are able to set a maximum Character count on Short Answer fields. This option is not necessary to set when creating calculations or setting prices. This functionality would mostly likely be used outside of calculations when you allow users to type in text/content and you want to cap the characters OR if you were asking for say, social security number and you wanted to cap the character count at 9 so that individuals enter the correct number of digits.
This field type allows for you to set Minimum and Maximum values on the field. If you choose to set a min. and/or max. value, one thing to make sure of is not to set either cap too high/low so that it is possible for the default calculation you have set to produce a number that is outside either cap. If you choose to use a slider, you must set a min. and max. value. You can also set a decimal place and the currency of a number field.In the second picture above, you will see that for Select List, Radio Button, or Checkbox fields, you add the value under the Options tab. First, click Options. Then, click Use separate values. Finally, when the Option Values column pops up, you will be able to type in a value. Important to note: these values MUST be unique. This doesn’t mean you can’t have 5 options that all cost $5. What we mean by unique is that they must LOOK unique. For example: 5; 5.0; 5.00. 5.000; 5.0000; and so on. These fields are basically set up the same, but there are a few differences:
- Checkbox & Radio Button Fields: you can select horizontal or vertical for the option layout.
- Radio Button Fields: important to note, only one option can be selected on these fields. Select Lists and Checkboxes allow for multiple option selections.
- Select List Fields: you can select the field size - basically, how many options you’d like to display in the select list automatically without scrolling.
As I mentioned above, you are able to set a hard default value for a field or use a calculation. This means you can use a calculation, including other fields with values, to determine the value of that field. Selecting use calculation under the Default Value option when creating/editing the field will allow you to select the fields with the value you would like to include in the calculation from a drop down list.
When you select a field on your form to include in a calculation, it MUST contain an associated number value or you will produce an NaN error in the destination field. This literally means “Not a Number”. This error occurs because you cannot calculate text or characters or pass text to another field using the use calculation function. We do offer “auto-fill” functionality that allows you to pass text entered in one field onto another field, but you must use the Auto-Fill plugin to accomplish this.
It is also important to remember to include ALL product/price fields from your form in your total field calculation so you are displaying the correct amount due to your customers. Any time you add/change a product, double-check and correct your total field calculation. It is really easy just to add the new product to the end of the calculation via the field drop-down list.
Integration Mapping: Product/Price Fields or Total Field?
When integrating with a payment processor, the easiest set-up is to use the single item option in the Transaction settings of the payment processor. That way, after you have set your form up with product/price fields and a total field based on a calculation of those product/price fields, you can map your total field from your form straight to the amount/price field in the integration settings. Then, your customers will always be charged the calculated amount based on their selections on the form.
If you choose to use the multiple item option, you will need to make sure you add an item for each possible product field selection on your form. Only those selected will be charged. You can offer quantity selection too, but you will need to create a separate quantity field for each product and map it accordingly in your integration settings. It might still be a good idea to include a total field on your form that will display the sum of the products selected, but you will not need to map to this in your integration settings if you are using the multi-item set-up.
- Make your total field read-only (you don’t want customers editing their total amount due!!)
- If you use a default value or a calculation on a field, make that field read-only as well
- Make fields that feed into your total field (or any) calculation required
- Number fields display up and down arrows. If you don’t like this appearance, use a Short Answer field.
- On quantity, or open-ended donation/price fields (using a Number field), set a minimum value of 0 so that customers can’t accidentally select a negative number.
- Don’t be afraid to use the Supporting Text functionality to explain product selections.
- Set the decimal place to 2 on number fields when you are displaying a currency.
It looks better.
Have your product/price fields and total fields set up? Check out these posts for tips on selecting a payment processor and accepting multiple payment methods:
Support How-To: Multiple Payment Methods
Not using Formstack yet? Click to sign up for a free trial today!