Trying to get a field in a form which shows the nbr of days between two datepickers, as soon as a valua in the 2nd has choosen
Field1: Arrivaldate
Field2: Departdate
Field3: Days>>To be showns as soon as Field2 has a value
Hope someone could be of assistance
Tx in advance
Rgds
S
Field1: Arrivaldate
Field2: Departdate
Field3: Days>>To be showns as soon as Field2 has a value
Hope someone could be of assistance
Tx in advance
Rgds
S
Hi SPABO,
You can do it using the On Success events of the DatePickers to run a JavaScript function - or this FAQ might help.
Bob
You can do it using the On Success events of the DatePickers to run a JavaScript function - or this FAQ might help.
Bob
I only have the standard elements in.
Any place to find an example? The FAQ isn't helpfull
Any place to find an example? The FAQ isn't helpfull
Hi SPABO,
I guessed you only had the standard elements in; but the RangePicker settings are designed to handle exactly what you are trying to do here.
Please see this FAQ which shows how to link two separate datepickers.
Bob
I guessed you only had the standard elements in; but the RangePicker settings are designed to handle exactly what you are trying to do here.
Please see this FAQ which shows how to link two separate datepickers.
Bob
Bob,
I think I will use this
http://www.chronoengine.com/faqs/2638-how-can-i-select-a-range-of-dates.html
To change the look and feel, I need this
Is this correct?
But actually I prefer to have the calcultaed nbr of days of the visitors stay :wink:
I think I will use this
http://www.chronoengine.com/faqs/2638-how-can-i-select-a-range-of-dates.html
To change the look and feel, I need this
$doc->addStyleSheet(JURI::base().'components/com_chronoforms/js/datepicker_moo/datepicker.css');
Is this correct?
But actually I prefer to have the calcultaed nbr of days of the visitors stay :wink:
Hi Bob,
Used this code snippet I found:
To calculate the "nights", I changed
The value loaded in a "hiiden"field, the Customcode in the section OnSubmit
Tx again!
Rgds
K
Used this code snippet I found:
<?php
$date_from = $form->data['fromdate_id'];
$date_to = $form->data['todate_id'];
$date_from = strtotime($date_from);
$date_to = strtotime($date_to);
$days = abs($date_to - $date_from);
$days = $days/(60*60*24);
$form->data['totaldays_id'] = $days;
?>
To calculate the "nights", I changed
$days = $days/(60*60*24);
to$days = ($days/(60*60*24))-1;
The value loaded in a "hiiden"field, the Customcode in the section OnSubmit
Tx again!
Rgds
K
Hi!
I need exactly the same calculation in a form in Chronoform V 3.2 (in one old joomla 1.5 site)
I tried with Spabo code, but no luck.
Php code in On submit - before sending email
hidden field at the end of the form
html code in email template
But the email (and the field in the connected table) are empty
notti:
It's the php code ok for this version of Chronoform? Or where is my error?
Thank you for any suggestions!
I need exactly the same calculation in a form in Chronoform V 3.2 (in one old joomla 1.5 site)
I tried with Spabo code, but no luck.
Php code in On submit - before sending email
<?php
$date_from = $form->data['arrival_date'];
$date_to = $form->data['departure_date'];
$date_from = strtotime($date_from);
$date_to = strtotime($date_to);
$days = abs($date_to - $date_from);
$days = ($days/(60*60*24))-1;
$form->data['total_nights'] = $days;
?>
hidden field at the end of the form
<input id="total_nights" name="total_nights" type="hidden" value=""/>
html code in email template
notti:{total_nights}
But the email (and the field in the connected table) are empty
notti:
It's the php code ok for this version of Chronoform? Or where is my error?
Thank you for any suggestions!
Nobody can give me a hint?
Tanks!
Tanks!
This topic is locked and no more replies can be posted.