- wendydroubayAsked on April 14, 2017 at 01:17 PM
I need help creating a form that will take an address, calculate the miles (from a predetermined location to the address they enter), and then generate a price based upon set conditions
Ex. 0-12 miles distance has a flat rate of $8 and anything over is an additional $.80 per mile.
After the price is generated I will need the form to charge them based on the calculations.
- JotForm SupportMike_GAnswered on April 14, 2017 at 04:18 PM
We have what we call Driving Distance widget.
This widget allows you to set a predetermined address set as an origination location. It also allows you to set a default distance unit (Miles) and hide the unit setting option to prevent respondents from changing it to kilometers. You can set the widget to auto calculate or have a calculate button to process the calculation. This widget is powered by Google Maps®.
The Driving Distance widget has actually two outputs, Miles and Feet. Feet is used if the output is less than a mile in distance. Since this needs to be considered as well, you need to get the text value of the output by adding a regular textbox field (Short Text Entry) on the form and create the condition below.
Next, you will use a number field for the Total Miles with a default value equal to 1.
And since you are able to determine the unit of the Driving Distance widget already, you will create a condition that states, "If the output in the "Output in text" field does not end with "ft" (feet), copy the value of the Driving Distance widget to the "Total Miles" number field."
As for the computation, you will need to create the conditions below after adding another number field, "Total Price".
Condition #1: If "Total Miles" is less than or equal to 12.
Condition #2: If "Total Miles" is greater than 12.
Once you are getting the correct/desired value in the Total Price number field, add a Form Calculation widget to your form and get the value from the Total Price field.
You will then use the Form Calculation field and pass its value to the payment field of your choice.
You may also choose to hide the fields you don't want your respondents to see in your form.
Here's the test form where I have applied the workaround above: https://form.jotform.com/71035629186964
Please feel free to clone it to your account so you can inspect it on your end.
I hope this helps. If you need any further assistance, please feel free to contact us again anytime.