CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Standard way for hiding fields
Pages: [1]

Author Topic: Standard way for hiding fields  (Read 591 times)

krytie

  • Guest
Standard way for hiding fields
October 06, 2010, 10:23:11 pm
I know that you can edit a copy of a tpl file to remove certain fields from an edit form, but what is the best way to remove a whole block of fields, for example the address fields on the contact edit form?

I could just create a custom copy of the Contact/Form/Edit/Address.tpl and remove all the template code from it, but this doesn't seem like an elegant way of doing this. Is there a way to edit the $blocks template variable before the page is constructed?

Some other methods I know of

1) Hide it client side through the use of CSS or Javascript. My preference would be to hide it on the server and not even deliver these hidden fields to the client.
2) Use the hook_civicrm_postProcess to remove these elements from the form, but I would need to remove a numerical index from the Drupal $form->_elements array. This seems very "hacky" to me.

Any thoughts?


petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Standard way for hiding fields
October 06, 2010, 10:36:22 pm
Have you ruled out doing what you want via making a Profile?
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Standard way for hiding fields

This forum was archived on 2017-11-26.