1

I have a created a custom group and a custom field within that group.

One of the Custom fields is Date.

Is there any way to autoload 'current date' (today) in the default value field Using a hook or something?

I have been googling but i am not getting any results.

Thanks

0

I did this by using CiviCRM hooks (BuildForm).

($form == CRM_Core_Action::ADD) {
        $currentDate = date('d/m/Y');
        for ($i = 1; $i < 10000; $i++) {
            $defaults['custom_197_-' . $i] = $currentDate;
            $form->updateElementAttr('custom_197_-'. $i,array('readonly'));
        }
        $form->setDefaults($defaults);
       } 

This is working

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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