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) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • "New Individual", "Advanced Search", hiding fields..
Pages: [1]

Author Topic: "New Individual", "Advanced Search", hiding fields..  (Read 3462 times)

user99

  • Guest
"New Individual", "Advanced Search", hiding fields..
April 22, 2009, 05:31:18 am
(1) For shortcut  "New Individual"

Is there a way to
- Remove/hide these inbuilt sections "Name and Greeting", "Communication Preferences", "Primary Location", "Demographics"?
- Add custom data fields?

(2) For shortcut "Advanced Search"

Is there a way to
- Under first search block, to remove/hide,  "Search Views", "CMS user?", "Privacy", "Contact Source"?
- Remove hide blocks "Address Fields", "Demographics"?

(3) I have added some custom fields, however, users are not able to view (& hence edit) them. Only admin is able to view. What settings need to be changed?

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
Re: "New Individual", "Advanced Search", hiding fields..
May 02, 2009, 05:57:25 pm
1 - you can hide fields by editing the template.  alternatively, you could create your own create contact profile which exposes only the fields you want to include.  custom data applicable to contacts will appear in the new contact screens by default (see below for reasons why it isn't)

2 - again, you could do so by editing the templates / code but this can't be configured through an interface.  you could use a profile or create a custom search to acheive something similar, or just live with it :-) it is advanced search after all.

3 - Have a look at Drupal permissions and see if users have 'access all custom data' checked.  If that doesn't help, try removing any CiviCRM ACL you have enabled.
Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

shanford

  • Guest
Re: "New Individual", "Advanced Search", hiding fields..
May 18, 2009, 12:06:15 pm
Quote from: michaelmcandrew on May 02, 2009, 05:57:25 pm
1 - you can hide fields by editing the template.  alternatively, you could create your own create contact profile which exposes only the fields you want to include.  custom data applicable to contacts will appear in the new contact screens by default (see below for reasons why it isn't)

2 - again, you could do so by editing the templates / code but this can't be configured through an interface.  you could use a profile or create a custom search to acheive something similar, or just live with it :-) it is advanced search after all.

I'm interested to see if someone may help me or steer me in the right direction.  I am trying to display custom data on the 'Individual' page depending on their selection of another custom data select field.  So, say they choose 'Lead' as one of the options from the drop down.  Then it would display the custom data that is associated with the 'Lead.'

I do not know what code to use to address and display my custom data in the template, nor do I know how to hide / display the pertinent custom data fields based on a selection.

Any help would be greatly appreciated!!

Thanks!
- Sean

shanford

  • Guest
Re: "New Individual", "Advanced Search", hiding fields..
June 02, 2009, 10:05:29 am
Anyone have any suggestions?

Thanks!!

- Sean

Quote from: shanford on May 18, 2009, 12:06:15 pm
Quote from: michaelmcandrew on May 02, 2009, 05:57:25 pm
1 - you can hide fields by editing the template.  alternatively, you could create your own create contact profile which exposes only the fields you want to include.  custom data applicable to contacts will appear in the new contact screens by default (see below for reasons why it isn't)

2 - again, you could do so by editing the templates / code but this can't be configured through an interface.  you could use a profile or create a custom search to acheive something similar, or just live with it :-) it is advanced search after all.

I'm interested to see if someone may help me or steer me in the right direction.  I am trying to display custom data on the 'Individual' page depending on their selection of another custom data select field.  So, say they choose 'Lead' as one of the options from the drop down.  Then it would display the custom data that is associated with the 'Lead.'

I do not know what code to use to address and display my custom data in the template, nor do I know how to hide / display the pertinent custom data fields based on a selection.

Any help would be greatly appreciated!!

Thanks!
- Sean

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: "New Individual", "Advanced Search", hiding fields..
June 02, 2009, 11:33:13 am
You might be able to do this by adding some javascript and some CSS to a custom copy of the template(s). Check out this doc first if you haven't already:
http://wiki.civicrm.org/confluence/display/CRMDOC/Customize+Built-in%2C+Profile%2C+Contribution+and+Event+Registration+Screens

Custom fields are assigned field names like this:
<input name="custom_2" ...

where 2 is the id of the field in civicrm_custom_field table.
Using Firebug or viewing html source for the form should get you started.
Protect your investment in CiviCRM by  becoming a Member!

shanford

  • Guest
Re: "New Individual", "Advanced Search", hiding fields..
June 02, 2009, 11:36:40 am
Dave,

Thank you very much for the reply.  No, I had not seen that link before. I had used this page for reference before, I appreciate your example on addressing the custom fields!!

Going to try it right now and will reply regardless.

Thanks again!

- Sean
« Last Edit: June 02, 2009, 11:47:31 am by shanford »

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
Re: "New Individual", "Advanced Search", hiding fields..
June 02, 2009, 11:53:44 am
Hi Sean,

What you are looking for isn't core functionality, but one way of achieving it would be to use the tabs hook - you could turn the visibility of a tab on and off dependent on the value of some custom data (that I'll refer to as the controlling custom data)

Depending on your requirements, you might also want to call a hook to delete any custom data held in a custom data group when the controlling custom data is unselected.

Have you used hooks before?  if not, a bit of reading up and a look at the civitest module is required :)

Also, here's a related question that I'd be really interested if someone else could answer:

There is tantalisingly named contact sub type field in the contact table, which I think I am write in saying doesn't do anything in a standard CiviCRM installation.  I would love to see this implemented as a way of defining custom data for specific types of contacts.  i.e. when you define some custom data for an organisation, be able to say, this is only available for the sub-type of the organisation.  i.e. this set of fields about funders is only relevant and therefore visible to those organisations that are funders.

This is a requirement that comes up with just about 100% of the clients I work with.  I've alluded to it on this wiki page comment (http://wiki.civicrm.org/confluence/display/CRM/CiviCase+-+Alpha+International+Requirements).  I would love to hear peoples thoughts on how and why this should/shouldn't be implemented.

Michael
Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

shanford

  • Guest
Re: "New Individual", "Advanced Search", hiding fields..
June 02, 2009, 12:43:50 pm
Michael,

Thank you for the reply.  No, I haven't used the system long enough (programmatically) to be comfortable with the hook API.  I appreciate your suggestion, but they are looking to have the data "in-line" based on their selection of the Contact Subtype.

I do agree with you regarding the use of Contact Subtype, as we are using it to control the type of data that is entered depending if they are a "Member," "Lead," and the list goes on.  I would love to have this functionality built-in instead of having to make changes that I need to track for upgrading.

Cheers!

- Sean

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: "New Individual", "Advanced Search", hiding fields..
June 02, 2009, 02:16:44 pm
Quote from: michaelmcandrew on June 02, 2009, 11:53:44 am
There is tantalisingly named contact sub type field in the contact table, which I think I am write in saying doesn't do anything in a standard CiviCRM installation.  I would love to see this implemented as a way of defining custom data for specific types of contacts.  i.e. when you define some custom data for an organisation, be able to say, this is only available for the sub-type of the organisation.  i.e. this set of fields about funders is only relevant and therefore visible to those organisations that are funders.

This is a requirement that comes up with just about 100% of the clients I work with.  I've alluded to it on this wiki page comment (http://wiki.civicrm.org/confluence/display/CRM/CiviCase+-+Alpha+International+Requirements).  I would love to hear peoples thoughts on how and why this should/shouldn't be implemented.

That field has been in the data model for quite a while - and I'm pretty sure the intent was to support the type of functionality you're describing (possibly also allowing "filtering" on core data fields as well based on sub-type). This has come up a fair amount and would be great if someone stepped up to implement or sponsor. (As a side note, I'm not sure the current implementation of the field - it's a varchar - makes sense. Might be better defined as a key to an option_value row.)
Protect your investment in CiviCRM by  becoming a Member!

shanford

  • Guest
Re: "New Individual", "Advanced Search", hiding fields..
June 02, 2009, 02:23:43 pm
Quote from: Dave Greenberg on June 02, 2009, 11:33:13 am
Custom fields are assigned field names like this:
<input name="custom_2" ...

where 2 is the id of the field in civicrm_custom_field table.
Using Firebug or viewing html source for the form should get you started.

Dave,

Not sure if you're still around, but I think I'm missing one key bit of information, or process.  Here is what I am putting in my custom Edit.tpl template to try and find the value of a particular custom field:

Code: [Select]
    {if $custom_45_2 eq 'Member'}
        <div id="customData">Member is selected!!</div>
    {else}
        <div id="customData">Something isn't right</div
    {/if}

custom_45_2 is the custom field I am trying to get the value from, how may I address it either in PHP or Javascript to return the value?

Thanks for your help!!

- Sean

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: "New Individual", "Advanced Search", hiding fields..
June 02, 2009, 04:59:37 pm
Sean - Since you're trying to make changes to HTML elements on the form dynamically, based on user actions - you need to use Javascript to detect and do something when the user changes the value of a field. There's some examples of this in civicrm/js/Common.js - function showHideByValue for instance.

If you're not up to speed on Javascript - you may want to get help from someone on this.
Protect your investment in CiviCRM by  becoming a Member!

shanford

  • Guest
Re: "New Individual", "Advanced Search", hiding fields..
June 08, 2009, 02:37:01 pm
Dave,

Sorry for the delayed response, I was out of reach for a couple of days.

With regard to your last response, Thanks.. I think I'm moving in the right direction by trying to use js and possibly even taking advantage of the included js libraries, but I am still having an issue with properly addressing the correct items on the template page to check the status of the custom fields.

As I had pasted in my last post:

Code: [Select]

{if $custom_45_2 eq 'Member'}
        <div id="customData">Member is selected!!</div>
    {else}
        <div id="customData">Something isn't right</div
    {/if}

I can't seem to address the custom field(s) correctly.  Are you suggesting that I try to use the DOM and js to call the fields and their values?

Thanks again for all of your assistance and time, it is truly appreciated.

- Sean

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: "New Individual", "Advanced Search", hiding fields..
June 08, 2009, 03:38:41 pm
Sean - My understanding is that you're trying to modify the form based on a field value selected by the user. For the "New Individual" form flow you've described, the smarty if / else code (above) can't do this - it can only affect what's displayed based on values that are present when the form is loaded. You need to use Javascript functions to respond to user actions on the form.

Note that this is a bit more tricky because you need to do it programmatically (i.e. unless you want to modify the core PHP files, you can't add onchange events to the field definitions directly). There's an example of this here:

http://lists.evolt.org/pipermail/javascript/2006-October/011341.html

... bottom line though - if you're not comfortable w/ javascript you'll need to get help from someone who is.

Protect your investment in CiviCRM by  becoming a Member!

shanford

  • Guest
Re: "New Individual", "Advanced Search", hiding fields..
June 09, 2009, 08:15:48 am
Dave,

Aaah, thank you!  Now I understand why I wasn't getting the results that I was expecting.

Thank you so much for the explanation.  Let's see what I can do.

Cheers!

- Sean

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • "New Individual", "Advanced Search", hiding fields..

This forum was archived on 2017-11-26.