What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.
At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.
We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.
Calculate total rate with amount of days selectedAsked by motoxplorers on February 03, 2015 at 12:01 PM
Hello from Portugal guys, I research in forum about a solution for this and I did not found any that suits my needs. Hope you can help me.
I'm building a form to book motorcycle rental, I manage to use the Form calculation Widget but I do not know how to include in the calculation the amount of days of rental.
You can check my form in http://form.jotformeu.com/form/50334785628361
What I need it's to include in the Total Rental a value per day corresponding to:
1 to 3 days: 105€/day
4 to 6 days: 95€/day
7 a 13 days: 85€/day
14 days +: 77€/day
I saw you guys did magic in other situations similar to this one, but to be honest with you I'm a complete dummy in this matters. My website it's on WIX so I can not include long scritps on it... the perfect solution wold be to import my form and had the calculations script on it so I can import him back...
if you can help me I really appreciate it :)
Obrigado / Thanks
selected calculate total rate amount
We are more than happy to help out. If I am not mistaken, you would like to know how to calculate the Total Charge that will be applied to a motorcycle rental that can span from 1 day to over 14 days with the various per day fees you mentioned above. To get this done we will definitely have to use conditional logic statements as well as the form calculation widget.
I have cloned your form and made the necessary changes below:
Unfortunately, the Date Picker widget that is currently on your form will not work as it should with the Form Calculation widget so it is recommended that you use the default Date Time Field under the Quick Tools tab.
We now need to use a Form Calculation Widget to calculate the difference between the pickup date and drop off date and use a Number field to store the daily charge. These fields should be hidden.
Now that we can have the day count, it is time for us to use conditional logic statements to determine the daily charge: https://www.jotform.com/help/268-How-to-Insert-Text-or-Mathematical-Calculation-into-a-Field-Using-Conditional-Logic
You should repeat this process with the appropriate condition for each price difference like shown below.
Now you are going to add the charge for the motorcycle rental to your Total Charge form calculation widget.
This should work just fine. Do let us know if further assistance is needed.
AMAZING!!! you not only did it for me, you explained how to do it and I now understand and know how to do it. Thank you Sean, Muito Obrigado!!
Actually there was some calculations not working in the right way on the form you build, but you explained so well that it was easy to correct. The total days were not being counted to the right number field and they were not included in the final calculation, thanks to you explanation it was easy to identify the error and correct it.
Thank you again, I will try now to insert a new parameter on the calculation, the pick up and drop off must be in the same hour so they complete 24h rental. If more than 24h we have to increase the calculation in one day. Like if someone pick the bike at 10AM and drop off on the next day at 6PM we have to calculate 2 days and not only one.
Lets see if I can do it myself with your teachings, if not I call for help again :)
Obrigado / Thank you
On behalf of my colleague @Sean, you are welcome.
Do try it yourself and get back to us if you have any questions, we will surely help you.
Hello guys, thanks to Sean and Ashwin help I manage to do all the form and it's working perfectly.
I'm proud of :) http://form.jotformeu.com/form/50342176208348
I just need your help for another 2 things I tried but I was not able to found how.
I need to count more than 24h hours period as + on day rental, so if a client book a bike from 10:00 on day 2 to 14:00 the form calculator can increase in a day the rentals days.
Do you think it's possible or it's to complicate? I tried to do it in the calendar picker and in normal drop down box with times from 10AM to 8PM (our store time table) but none of those let me chose the right calculation formula.
The second thing it's a little bit simple I think, I just can not do it because I can not edit the code (the form codes must be hosted in your servers and I can not edit it).
I need to put the prices of optional accessories as sub labels in smaller letters under the description of the optionals. I can not do it because check boxes do not allow sub labels.
Hope you can help me again
Obrigado / Thank you
To address the 24 hours issue, I understand that you want to add another day if the vehicle is held with the customer more than 24 hours period.
Following are the changes that I made to your cloned JotForm.
1. Removed dropdown boxes for time field and added time field instead
2. Added a calculation (hidden) field to the form to calculate time difference
3. Added another calculation (hidden) field to add 1 if there is a positive time difference for additional day rental.
4. Add another day field value to Rental days.
Please see the below JotForm if that meets your requirement.
Please check and let us know if this works for you.
The other query on formatting the prices as sublabels shall be addressed separately at the below thread.
Hi Kiran, that should work perfectly for my needs, but the I have now two issues...
1th issue: the client can select pick ups at 1am, 6am and so.. I need to fix this in only my store time table, from 10AM to 8PM only.
2th issue:do you know how to enlarge a bit the time field box in the form? It's not pretty as it is, cutting the numbers ;)
Thank you for you help, I really appreciate it! JotForm team is amazing.
Okay. I've changed the time field to dropdown for both pick-up and drop-off and added calculation values to it. The calculations and conditions remain same as we did for time field.
Please see the updated JotForm at http://www.jotformpro.com/form/50345137227955
You may clone this JotForm to your account by following the guide
Hope it works for you!
The second issue with enlarging the time field is moved to a separate thread and shall be addressed there.
Let us know if you need any further assistance. Thanks!
Thank you again, I was doing exactly that with the same calculation formula you show me in the time field explanation and it worked perfectly,
check it here: http://form.jotformeu.com/form/50353719334353
I'm proud of myself, thanks to the amazing support of all the Jotform team.
Now I just need to clone for other bikes, change the day rates and that it.
My next battle it's to export this to a pdf rental contract but that another war ;)
Thank you so much Sean, Ashwin and Kiran!!!
On behalf of all my colleagues, you are welcome.
Do get back to us if you have any questions.