Hello!
I'm just starting out with Joomla and ChronoForms and am working on a vacation request form. I have it "working" but I wanted to do some calculations and auto-populate the total hours taken into a field. Based on the radio button they select, it populates the total hours ( 4 or 8 ) taken. But I need to count the days, times by the hours, then populate the total hours. Has anyone done this? Any help here would be great! I've added my code to the bottom.
I'm just starting out with Joomla and ChronoForms and am working on a vacation request form. I have it "working" but I wanted to do some calculations and auto-populate the total hours taken into a field. Based on the radio button they select, it populates the total hours ( 4 or 8 ) taken. But I need to count the days, times by the hours, then populate the total hours. Has anyone done this? Any help here would be great! I've added my code to the bottom.
<?php
// Get user-information from Joomla
$user = &JFactory::getUser();
?>
<input type="hidden" value="<?= $user->name; ?>" name="user" />
<input type="hidden" value="<?= $user->email; ?>" name="email" />
<div class="ccms_form_element cfdiv_datetime" id="start_date_container_div"><label>Start date</label><input maxlength="150" size="16" class="cf_date_picker" title="" type="text" value="" name="start" />
<div class="clear"></div><div id="error-message-start"></div></div><div class="ccms_form_element cfdiv_datetime" id="end_date_container_div"><label>End date</label><input maxlength="150" size="16" class="cf_date_picker" title="" type="text" value="" name="end" />
<div class="clear"></div><div id="error-message-end"></div></div><div class="ccms_form_element cfdiv_radio" id="time_frame_container_div"><label>Time Frame</label>
<input type="radio" name="radio" id="radio_am" title="" value="AM" onClick="javascript:document.getElementById('totalhours').value=4" class="validate['required']">
<label for="radio_am">AM</label>
<input type="radio" name="radio" id="radio_pm" title="" value="PM" onClick="javascript:document.getElementById('totalhours').value=4" class="validate['required']">
<label for="radio_pm">PM</label>
<input type="radio" name="radio" id="radio_all_day" title="" value="ALL DAY" onClick="javascript:document.getElementById('totalhours').value=8" class="validate['required']">
<label for="radio_all_day">ALL DAY</label>
<div class="clear"></div><div id="error-message-radio"></div></div><div class="ccms_form_element cfdiv_submit" id="input_submit_7_container_div"><input name="input_submit_7" class="" value="Submit" type="submit" />
<div class="clear"></div><div id="error-message-input_submit_7"></div></div><div class="ccms_form_element cfdiv_text" id="total_hours_container_div"><input maxlength="150" size="30" class="" title="" id="totalhours" type="hidden" value="" name="totalhours" /><div class="ccms_form_element cfdiv_text" id="number_of_working_days_container_div">