When creating a new Activity record, I need to require the "With contact" and "Assigned to" fields have a contact selected.

In the activity/form/activity.php file I can add 'required'=>TRUE to the various arrays, but that setting only works for the fields without a selector (e.g. subject, location, duration).

This can certainly be done with javascript in an extra.tpl file (and might be preferable, as it can be conditional to the activity type), but is there a way to modify either the template or php files to require a selected contact?

1 Answer 1


The best way to handle this is with an extension that calls hook_civicrm_validateForm. Documentation is available here: http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_validateForm

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.