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 »
  • Using Profiles (Moderator: Dave Greenberg) »
  • Re-using custom field with different options for different profiles
Pages: [1]

Author Topic: Re-using custom field with different options for different profiles  (Read 588 times)

Eliet Henderson

  • I post occasionally
  • **
  • Posts: 49
  • Karma: 4
  • CiviCRM version: 4.4.7
  • CMS version: Drupal 7
  • MySQL version: 5.0
  • PHP version: 5.2
Re-using custom field with different options for different profiles
March 17, 2011, 01:56:09 pm

So I created a custom field called "How did you hear about this event?" and several multiple choice options, then put it in a profile for event participants.

Now I want to use this question again, for a different event, i.e., exposed in a different profile. But for Event #2, I want different multiple choice options. Is there a way I can re-use the existing custom field, but display different multiple choice options in a different profile? I considered disabling the multiple choice options for event #1 and enabling new options for event #2, but the problem is that I want both profiles to be active at the same time (because registration is open for two different events at the same time).

The alternative seems to be setting up a new "How did you hear about this event?" field for each event, which seems like it defeats the purpose of being able to reuse custom fields & a good way to clutter my database.

Am I overlooking another way to do this?

Thanks.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Re-using custom field with different options for different profiles
March 17, 2011, 03:13:09 pm

you can use a hook for this, check:

http://wiki.civicrm.org/confluence/display/CRMDOC33/CiviCRM+hook+specification#CiviCRMhookspecification-hookcivicrmcustomFieldOptions

basically hide all the options for event 2 when rendering for event 1 and vice versa. You'll need to figure out what "page" you are on potentially from the GET / POST variables

better yet, you can do this via a jQuery snippet on the page. Just hide the options you dont need in the custimized template:

http://wiki.civicrm.org/confluence/display/CRMDOC33/Customizing+CiviCRM+Screens


lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • Re-using custom field with different options for different profiles

This forum was archived on 2017-11-26.