Hi everyone,
I'm loocking for ad in my chronoform a filter beetwen data a i find different tutorial but in my case doesn't work.
I start to my model (the name is dogan and the field is data in Y/m/d format):
- i add in the model condition this code:
- next i add in the header of custom code:
--before in the start of the header this code:
I tryed for more time to change the condition in the model condition or another change but it doesn't work very well. for completely i stamp all my header do:
--> in the footer close the div
I'm loocking for ad in my chronoform a filter beetwen data a i find different tutorial but in my case doesn't work.
I start to my model (the name is dogan and the field is data in Y/m/d format):
- i add in the model condition this code:
<?php if(\GCore\Libs\Request::data("min") || \GCore\Libs\Request::data("max")){ return array("dogan.data >=" => \GCore\Libs\Request::data("min"), "dogan.data <=" => \GCore\Libs\Request::data("max")); } ?>- next i add in the frontList setting filter dogan.data
- next i add in the header of custom code:
--before in the start of the header this code:
<?php $document = \GCore\Libs\Document::getInstance(); $document->_('jquery'); $document->_('gdatetimepicker'); $document->addJsCode('jQuery(document).ready(function($){ $("#min").gdatetimepicker(); $("#max").gdatetimepicker(); });'); ?>--and after in the filter field:
</tr> <tr> <td style="vertical-align: top; width: 50%;"><br> <input type="text" id="min" name="min" placeholder="da...(data)" class="form-control A" /> </td> <td style="vertical-align: top; width: 50%;"><br> <input type="text" id="max" name="max" placeholder="fino a...(data)" class="form-control A" /> </td> </tr>--> Now there is two problem: The filter doesn't serch how i set it, and another proble when i made search the datapicher field doesn't return empty but stay the value before reserched.
I tryed for more time to change the condition in the model condition or another change but it doesn't work very well. for completely i stamp all my header do:
<?php $document = \GCore\Libs\Document::getInstance(); $document->_('jquery'); $document->_('gdatetimepicker'); $document->addJsCode('jQuery(document).ready(function($){ $("#min").gdatetimepicker(); $("#max").gdatetimepicker(); });'); ?> <table style="text-align: left; width: 100%;" border="0" cellpadding="2" cellspacing="2"> <tbody> <tr> <td style="vertical-align: top; width: 50%;"><br> <input type="text" name="srch" placeholder="cliente (ricerca)" class="form-control A" /> </td> <td style="vertical-align: top; width: 50%;"><br> <select name="fltr[dogan][motivo]" placeholder="" class="form-control A" /> <option value="">motivo (filtro)</option> <?php $db =& JFactory::getDBO(); $query = "SELECT DISTINCT `motivo` FROM `sinc_tabelle_personalizzate_visualizza_controllo_doganale` ORDER BY `motivo`"; $db->setQuery($query); $nomes = $db->loadObjectList(); foreach ( $nomes as $v ) { echo '<option value="'.$v->motivo.'">'.$v->motivo.'</option> '; } ?> </select> </td> </tr> <tr> <td style="vertical-align: top; width: 50%;"><br> <input type="text" id="min" name="min" placeholder="da...(data)" class="form-control A" /> </td> <td style="vertical-align: top; width: 50%;"><br> <input type="text" id="max" name="max" placeholder="fino a...(data)" class="form-control A" /> </td> </tr> <tr> <td style="vertical-align: top; width: 50%;"><br> <select name="fltr[dogan][dog]" placeholder="" class="form-control A" /> <option value="">dogana (filtro)</option> <?php $db =& JFactory::getDBO(); $query = "SELECT DISTINCT `dog` FROM `sinc_tabelle_personalizzate_visualizza_controllo_doganale` ORDER BY `dog`"; $db->setQuery($query); $nomes = $db->loadObjectList(); foreach ( $nomes as $v ) { echo '<option value="'.$v->dog.'">'.$v->dog.'</option> '; } ?> </select> </td> </tr> </tbody> </table> <br> <input type="submit" name="submit" value="Cerca" /> <script type="text/javascript"> function printDiv() { var a = window.open('',"b", "height=500,width=600,menubar=yes,scrollbars=yes,resizable=yes,,left=10,top=10"); a.document.open("text/html"); a.document.write(document.getElementById('foo').innerHTML); a.document.close(); a.print(); } </script> <div style="text-align: right;"> <input onclick="printDiv();" type="image" src="<?php echo JURI::base().'images/printButton.png';?>" title="Stampa" alt="Stampa"/></div> <div id="foo"> <br>
--> in the footer close the div