How do I add a date picker to a Connectivity V5 connection?

NickOg 26 Jan, 2015
Hi

Can anyone tell me how to set up a date picker as a filter for a CC5 connection? Or point me in the right direction? I can think that I could write some code to form a date from some drop-downs and filter on some derived matching field but a date picker would be easier.

Any suggestion would be appreciated.

Regards
Nick
cenzomita 09 Feb, 2015
Hi,
I tried to put code in header to load the same calendar of chronoform. It should run but I don't know the problem. The following code I used:
<?php
JHtml::_('jquery.framework');
JHtml::_('bootstrap.framework');
$doc =& JFactory::getDocument();
$doc->addScript(JURI::base().'libraries/cegcore/assets/gplugins/gdatetimepicker/gdatetimepicker.js');
$doc->addStylesheet(JURI::base().'libraries/cegcore/assets/gplugins/gdatetimepicker/gdatetimepicker.css');
$script ="
jQuery(document).ready(function(jQ) {
  jQ('#dataFrom').gdatetimepicker();
  jQ('#dataTo').gdatetimepicker();
  jQ(\":input\").on(\"select_date.gdatetimepicker\"', function(){
    if($(this).data('on_date_selected')){
      var on_date_selected = $(this).data('on_date_selected');
      if(on_date_selected in window){
	window[on_date_selected](jQ(this));
      }
    }
  });
});
";
$doc->addScriptDeclaration($script);
?>

while the field date is the following:
<input type="text" id="dataFrom" name="dataFrom" data-gdatetimepicker-format="d-m-Y" placeholder="" size="9" class="validate['required'] form-control A" title="" style="display:inline;" data-load-state="" data-tooltip="" type="text" data-fieldtype="gdatetimepicker" data-start_view="d"  />


Can anyone help me?
Max_admin 09 Feb, 2015
Answer
Please try the following code, and make sure you have the latest update:

<?php
$document = \GCore\Libs\Document::getInstance();
$document->_('jquery');
$document->_('gdatetimepicker');
$document->addJsCode('jQuery(document).ready(function($){
	$("#field_id").gdatetimepicker();
});');
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
cenzomita 09 Feb, 2015
It runs, great!!
Thanks.
NickOg 19 Feb, 2015
Hi
Can you clarify that for me please? Does Max's code replace all of cenzomita's code (except the <input line of course)? I have tried that without success. If you would be willing to post the final complete section I would appreciate that.

Thanks and regards

Nick
Max_admin 20 Feb, 2015
Hi Nick,

Yes, my code should work and you would only need an input with the id = "field_id" as defined in the code!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.