Use date_picker in Custom pages

ryno

New member
Good Day

I have created a custom page (PHP file) under include\custom_php_files to do a special formatted report for me based on a SQL query generated in the PHP custom file. The custom page also have some search fields at the top of which the values are used in the PHP code to generate the SQL query.

Everything works fine, but I have an issue with a date search field. I can enter the date in the field manually and the query works, but I am trying to get the date_picker to pop up when I give the field focus, similar to date fields in the other standard pages of DaDaBIK. I have looked at your pages and code and try to create my fields the same way (ID and Class), but somehow I cannot get it to pop-up. For now we use it by manually entering the date in the field.

Is there a way to use your date_picker in custom pages and how can I do that?

This database is running on DaDaBIK version 8.3-Lerici enterprise.

Your support is always much appreciated.
 

eugenio

Administrator
Staff member
Hello Ryno,
at the moment there isn't official way to use the datepicker in a custom PHP page but if you have a textbox and, as ID, you assign something like "date_picker_1", so:

<input type="text" id="date_picker_1">

you should get it automatically. Please be sure to have a unique id for each field you have in your form.

Best,
 

ryno

New member
Hi Eugenio

Thank you for the response. I did some more testing and now it is working.

Interestingly, if I include the 'class="hasDatepicker"' to the input element, as I saw when I did an Inspect Element from the browser on one of the other pages, the datepicker does not pop up. When I remove this class from the input element, then it works fine.

Does not work: echo '<input name="_cp_first_date" class="hasDatepicker" id="date_picker_first_date" type="text" value="'.$_cp_startdate.'">';

Do work: echo '<input name="_cp_first_date" id="date_picker_first_date" type="text" value="'.$_cp_startdate.'">';

Anyway, if is work now, thanks to your example.

Thank you for your support.
 
Top