Date time picker events

Mohamed-Hedi 02 Oct, 2010
Hello all,

I'm new to PHP, joomla, chronoforms ... I'm trying datetimepicker and I have many questions. I have tried to find a solutions in the forums without sucess. I hope anyone can help me resolving my issue.

I have a date time picker and a drop down item.
My drop down options will be calculated depending on the day of week selected in the date time picker.

1- I have tried to rase event when new date is selected using the following code :
    <?php
    $script = "
    window.addEvent('domready', function() {
      function test() {
alert('test');
              }

function test2() {
alert('test2');
              }

      $('res_date').addEvent('click', test);
      $('res_date').addEvent('change', test);
      $('select_1').addEvent('change', test2);
    });
    ";
    $doc =& JFactory::getDocument();
    $doc->addScriptDeclaration($script);
    ?>
<div class="form_item">
  <div class="form_element cf_datetimepicker">
    <label class="cf_label" style="width: 150px;">Reservatioin date</label>
    <input class="cf_datetime" title="" size="20" id="res_date" name="res_date" type="text" />
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label" style="width: 150px;">hours</label>
    <select class="cf_inputbox" id="select_1" size="1" title=""  name="select_hour">
    <option value="">Choose Option</option>
      <option value="10:00">10:00</option>
<option value="11:00">11:00</option>
<option value="12:00">12:00</option>

    </select>
    
  </div>
  <div class="cfclear"> </div>
</div>

but it does not work😟
questions:
How can I rase an event when selecting date in datetimepicker
How can I get the day of the selected date
What are the events we can rase on datetimepicker?
Is there any documentation about this sweet component ?

Thanks
Mohamed-Hedi 03 Oct, 2010
Hi,

I discovered when investigating that the calander used in chronoforms is the aeron calander http://www.electricprism.com/aeron/calendar/.
And the res_date is the identity of the input in the right of it.
In the aeron calander description they give the events we can raise on it. The one I'll use is the "OnHideComplete".
I also find a post in the forums give me the way to get the date
Calendar.calendars[0].val
.

However I still dont know where to found the calander variabale name to perform the previous code in my form load event.
Could you help plz.
Mohamed-Hedi 03 Oct, 2010
Ok it seam chronoforms adds "myCal_" to the input id in my case the id of the calendar will be "MyCal_res_date".
Thats good now I'm getting the date value , but the onHideComplete event is not appropriate for getting this date.
any idea?
GreyHead 03 Oct, 2010
Hi Mohamed-Hedi,

Tricky, I'm not sure how you'd capture the date change. I'm no expert here. It doesn't look as though there is an onChange function in the Calendar and the JavaScript onChange does't seem to be 100% reliable if the change is made by a acript.

You might find some help from this thread

Bob
Mohamed-Hedi 03 Oct, 2010
Hi GreyHead,

Thank you you for your update, I tried to change the calendar javascript file but it was huge complicated.
So, I 'll try an other calendar.

Thank you
This topic is locked and no more replies can be posted.