Good morning
I would like to ask if it was possible to make an automatic calculation.
That is, I would use the form within a reservation, and then wonder if it is possible to calculate the total cost of the stay, by calculating the total number of nights of accommodation.
The total number of nights I could do using "DataPicker Box" (Or other)
Thanks
Hi dheio,
You can use Custom JavaScript in the form On Load event (and/or custom PHP in the On Submit event). Or you could use a date-picker just for the start dates, let the user specify the length and calculate the end date.
Bob
Hi Bob ,
thank's for your reply.
So If I have the number of night, Can I calculate the total price?
Example: 3 night * € 50 = Total € 150
Thank's
Hi dheio,
Yes you can - as I said, you'll need to write a few lines of custom code to do that.
Bob
Hi Bob,
and thank's for your reply..
I'm ashamed to say it, but I can not find "Custom JavaScript in the form On Load event"
I read here https://www.chronoengine.com/faqs/54-cfv4/cfv4-validation/2597-how-can-i-add-javascript-to-my-form.html, but nothing.. where is th Load Event?
Thanks
Hi dheio,
If you are using the Simple Wizard then there is a JavaScript tab you can see when you click the Setup button.
Bob
Hi Bob
thank's for you reply,
so can I write in php in Javascript tab?
Thanks
Hi dheio,
Well, yes you can - as long as the result is valid JavaScript.
Bob
Hi Bob,
sorry for my delay..
unfortunately I'm not very good with the Javascript code.
I tried to make this code but nothing happens
var arrivo={dataarrivo};
var partenza= {datapartenza};
totgiorni=dataarrivo - datapartenza ;
console.log(togiorni);
Hi dheio,
This isn't JavaScript var arrivo={dataarrivo}; - there are many many examples in the forums here.
Bob