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 (Moderator: Dave Greenberg) »
  • Default options in drop down list.
Pages: [1]

Author Topic: Default options in drop down list.  (Read 722 times)

laidback

  • I’m new here
  • *
  • Posts: 22
  • Karma: 0
  • Always looking for answers, so I can share it.
  • CiviCRM version: 3.3.5, 4.0.7,4.0.84.1
  • CMS version: Drupal 6, Drupal 7 and Joomla 1.6
  • MySQL version: 5.1.58
  • PHP version: 3.4.7.1
Default options in drop down list.
November 17, 2010, 12:54:16 pm
Hi creating a profile for a sign up form to be published on Drupal. In that profile I have preferred languages as a drop down list. How do I make English the default language?

I'm using civi 3.2.3

Rajan Mayekar

  • I post frequently
  • ***
  • Posts: 177
  • Karma: 20
    • Rajan's Blogs
Re: Default options in drop down list.
November 17, 2010, 09:23:58 pm
Quick solution is to implement hook_civicrm_buildForm ( http://wiki.civicrm.org/confluence/display/CRMDOC32/CiviCRM+hook+specification#CiviCRMhookspecification-hookcivicrmbuildForm ) in your custom module.
here code snippet for you
Code: [Select]
<?php
function modulename_civicrm_buildForm( $formName, &$form ) {
    if ( 
$formName == 'CRM_Profile_Form_Dynamic' && 
         
$form->elementExists( 'preferred_language' ) ) {
        
$form->setDefaults( array( 'preferred_language' => 'en'));
    }
}
?>


Rajan

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • Default options in drop down list.

This forum was archived on 2017-11-26.