I find that in many case some of the default fields on activities are not relevant. what's the best approach to editing the templates so that I can control what fields appear on activity forms?
-
1I can see here - civicrm.stackexchange.com/questions/7101/… - that using jQuery or CSS to hide fields is one approach. in the interests of helping users, does anyone know of any tutorial or guidance on how to do this that we can point to? – Graham Feb 3 '16 at 14:10
-
Here's one: wiki.civicrm.org/confluence/display/CRMDOC/Page+Templates includes a section on how to approach using jQuery to alter a form. – Graham Feb 3 '16 at 14:22
-
And here's some useful guidance from Hershel: civicrm.org/blogs/hershel/how-customize-civicrm-pages-jquery – Graham Feb 3 '16 at 14:23
-
And this from Jackrabbithanna: jackrabbithanna.com/articles/… – Graham Feb 3 '16 at 14:25
-
And there's some useful information in Tony Horrocks' CiviCRM Cookbook, available from all good bookshops. – Graham Feb 3 '16 at 14:32
Graham, there are loads of tutorials on how to use jQuery. The CiviCRM approach would be:
- Identify the ID of the field to hide using FireBug (or the inspect element function of your browser)
- Add a template with the jQuery required to hide the identified id's which will be something like this:
{literal}
cj(document).ready(function() {
cj('#firstTestID').hide();
cj('#secondTestID').hide();
});
{/literal}
- Add a hook in an extension to add the template with your hides to the template with something like this statement:
OR add the jQuerys to a .extra template (in the documentation https://wiki.civicrm.org/confluence/display/CRMDOC/Page+Templates)CRM_Core_Region::instance('page-body')->add(array('template' => 'GroupProtect.tpl'));
Does this help?
-
Thanks Erik. I guess my goal here is in part to provide a useful resource and a set of pointers. Your input is invaluable, as always. – Graham Feb 3 '16 at 14:34