Forums

datepicker filtering

admin_wiky 28 Apr, 2016
Hello there,
I need put datepicker for filtering fromDate and find out this topic

but I have a problem with date format. even though I have set format Y-m-d the date is displayed in the format m-d-Y - 28-04-2016
<input type="text" id="cf_creted" name="fltr[navstevy][datum]" data-gdatetimepicker-format="Y-m-d" placeholder="" size="9" class="form-control A" title="" style="display:inline;" data-load-state="" data-tooltip="" type="text" data-fieldtype="gdatetimepicker" data-start_view="d"  />

and I dont know where is the problem? is input name correct? Navstevy is model, datum is column
[attachment=0]ScreenShot938.jpg[/attachment]
<?php
  $document = \GCore\Libs\Document::getInstance();
  $document->_('jquery');
  $document->_('gdatetimepicker');
  $document->addJsCode('jQuery(document).ready(function($){
   $("#cf_creted").gdatetimepicker();
  });');
?>


thx for hint
GreyHead 28 Apr, 2016
Hi homeopat,

Please post a link to the form so I can take a quick look.

Bob
GreyHead 28 Apr, 2016
Answer
Hi Homeopat,

Sorry, I can’t spot the problem, the format is set correctly in the datepicker input. But when it is applied to the datepicker it is failing. You might try adding an attribute in the Extra fields element data-format=Y-m-d and see if that works.

It seems to work correctly in a ChronoForm so I guess that something in the CC setup is breaking it.

Bob
admin_wiky 29 Apr, 2016
Hi Bob,
thx, I added as a extra parameter and works.
but filtering doesnt works as is mentioned in previous article.
I want to use datepicker to filter data from the choosen date to today (now) but I am not sure, if the code is correct
thank you
admin_wiky 29 Apr, 2016
solved previous post
thx
This topic is locked and no more replies can be posted.