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) »
  • CiviCRM newbie: How can i have a custom field select list powered by an SQL
Pages: [1]

Author Topic: CiviCRM newbie: How can i have a custom field select list powered by an SQL  (Read 917 times)

shinzan

  • I post occasionally
  • **
  • Posts: 49
  • Karma: 0
  • CiviCRM version: 4.2
  • CMS version: Joomla 2.5.8
  • MySQL version: 5
  • PHP version: 5
CiviCRM newbie: How can i have a custom field select list powered by an SQL
December 27, 2012, 03:06:32 pm
Hi I have a custom field called clubID and I want the user to select which clubid they belong to based off the database, how can i create a custom field called clubID for the individual members in which the source for the dropdown is powered by an SQL query instead of pre defined choices?  I've searched the forum and suspect this is a job for a custom hook??  If so can anyone point out an example or help point me in the right direction?  I'm comfortable in PHP and SQL this is just my first CiviCRM project.

Thanks!!

David

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: CiviCRM newbie: How can i have a custom field select list powered by an SQL
December 28, 2012, 12:58:26 am
You would probably want to populate the custom field in the buildForm hook (check http://book.civicrm.org/developer/current/techniques/hooks/ and http://wiki.civicrm.org/confluence/display/CRMDOC42/Hook+Reference )? Alternative is to add it to the form with jQuery (see http://civicrm.org/blogs/dave-greenberg/now-its-easier-add-custom-behaviors-templates)
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: CiviCRM newbie: How can i have a custom field select list powered by an SQL
December 30, 2012, 04:47:22 am
shinzan, if your clubID is really a Contact ID, then see http://civicrm.org/blogs/xavier/how-customise-contact-reference-custom-field
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

shinzan

  • I post occasionally
  • **
  • Posts: 49
  • Karma: 0
  • CiviCRM version: 4.2
  • CMS version: Joomla 2.5.8
  • MySQL version: 5
  • PHP version: 5
Re: CiviCRM newbie: How can i have a custom field select list powered by an SQL
December 31, 2012, 05:45:51 am
I found some other posts detailing custom hooks but in the interest of simplicity I have reset the identity seed of civicrm contactID and imported all contacts to match, the clubid will just have to change, such is life...

Thanks!

David

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • CiviCRM newbie: How can i have a custom field select list powered by an SQL

This forum was archived on 2017-11-26.