We have one custom extension which try to add additional field on scheduled job New/Edit screen using hook.

    function jobextra_civicrm_buildForm($formName, &$form) {
      if ($formName == 'CRM_Admin_Form_Job') {
        $form->add('datepicker', 'job_date_time_start', ts('Date & Time Start'), NULL, FALSE, ['minDate' => date('Y-m-d')]);
        $form->add('datepicker', 'job_date_time_end', ts('Date & Time End'), NULL, FALSE, ['minDate' => date('Y-m-d')]);
        // there are other non date related field

and supporting extra.tpl file templates/CRM/Admin/Page/Job.extra.tpl

<script type="text/javascript">
    CRM.$(document).ready(function() {
         // other fields are inserted...

<table style="display:none;">
    <tr class="crm-job-form-block-name_job_date_time_start" style="">
        <td class="label">{$form.job_date_time_start.label}</td>
    <tr class="crm-job-form-block-name_job_date_time_end" style="">
        <td class="label">{$form.job_date_time_end.label}</td>

Date field is not rendering correctly, instead of showing date picker field and time field, i am just seeing simple textfield.

If i put these 2 field into core templates/CRM/Admin/Form/Job.tpl, both field rendered correctly.

Since this is in extra.tpl , tpl file load outside crm-container, and then we moving these field using jQuery into right position inside crm-container.

that may be issue?.

1 Answer 1


You need to initialize datepicker field


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.