2

This answer is great! everything works fine with the datepicker.

But I have a problem with datetime-picker. as I see from another datetime field (without default value), the class used by that field defined as datetime-input.

So I tried to use :

$crud->set_js_config('assets/grocery_crud/js/jquery_plugins/config/jquery.datetime.config.js');

...

<script type="text/javascript">var js_date_format = "dd/mm/yyyy HH:mm:ss"; </script>
<input name="date" type="text" value="'.date("d/m/Y H:i:s").'" class="datetime-input" />
<a class="datetime-input-clear ui-button " tabindex="-1" role="button">Clear</a> 

even i've tried using class "timepicker" :

<input name="date" type="text" value="'.date("d/m/Y H:i:s").'" class="datetime-input timepicker" />

but the jquery datetime picker function is not available. Any idea how to make it works? Thank you

Community
  • 1
  • 1
Darryl RN
  • 7,432
  • 4
  • 26
  • 46
  • I cant understand your issue >> Are you looking for datetime picker field on add.. with default value or without ? – Abu Yousef Apr 03 '16 at 21:00
  • yes, I need a datetime picker field with default value. As I described at the second code, I want to show that field with value datetime "d/m/Y H:i:s". But, if I just use the code I wrote, the datetime picket not working, it won't show when i click the field. – Darryl RN Apr 09 '16 at 12:28

1 Answers1

0

try to use callback field values.

$crud->callback_add_field('date_feild_name',array($this,'set_default_date'));

public function set_default_date(){
$value = date("d/m/Y");
$return = '<input id="field-date_feild_name" name="date_feild_name" type="text" value="'.$value.'" maxlength="10" class="datepicker-input hasDatepicker">
        <a class="datepicker-input-clear" tabindex="-1">Date feild name</a> (dd/mm/yyyy)';
return $return;
}