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) »
  • Discussion (deprecated) »
  • Feature Requests and Suggestions (Moderator: Dave Greenberg) »
  • Defaults for Custom Fields
Pages: [1]

Author Topic: Defaults for Custom Fields  (Read 2781 times)

ljk

  • Guest
Defaults for Custom Fields
February 03, 2008, 09:32:39 pm
When creating a custom field of type CheckBox, it would be great if, in addition to specifying, for each option, whether to make the option value 'selected' by default, you could specify whether to make the option value 'selected' if PHP code also specified returned true.  A simple example (maybe this is all that is needed) would be $_GET['foo']=='bar'.

I am a first-time CiviCRM user and just set up a Drupal site (www.bookwish.org) where I created a "Donation Earmark" CheckBox field for my CiviContribute contribution page.  I wanted the default earmark to depend on what link the user followed to arrive at the contribution page.  So, if he was reading about library construction in a refugee camp and clicked the inline donation link on that page, I wanted the "library construction" field of the contribution page to be checked by default.  The easiest solution I could find was modifying CRM > UF > Form > Block.tpl with some search-and-replace smarty code.  Perhaps, as a new user, I have missed an easier approach?  If not, please consider adding this functionality for CheckBox and other fields where it makes sense.

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Defaults for Custom Fields
February 05, 2008, 02:41:48 pm
Thanks for the input and specific use case. There is an issue in the 2.1 queue which hopefully will handle this type or requirement going forward:
http://issues.civicrm.org/jira/browse/CRM-1594
Protect your investment in CiviCRM by  becoming a Member!

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: Defaults for Custom Fields
June 02, 2008, 04:46:48 pm

This is now filed and fixed at: http://issues.civicrm.org/jira/browse/CRM-3176

i chose the option of implementing it as a hook. this gives the user more flexibility of how/when to set the defaults based on the input and/or the database state
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) »
  • Discussion (deprecated) »
  • Feature Requests and Suggestions (Moderator: Dave Greenberg) »
  • Defaults for Custom Fields

This forum was archived on 2017-11-26.