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) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • how do I set a default date now the date fields have changed?
Pages: [1]

Author Topic: how do I set a default date now the date fields have changed?  (Read 689 times)

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
how do I set a default date now the date fields have changed?
June 21, 2011, 04:20:13 pm
In 3.4.3 the way date fields are rendered has changed.

I was using the buildForm hook to set one custom date field to default to today's date.

    $defaults['custom_113_-1'] =  date("Y-m-d");
    $form->setDefaults($defaults);

I can't quite see how I should change my code to set it now (post 3.4.3)

Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: how do I set a default date now the date fields have changed?
June 22, 2011, 06:58:57 pm
Check below code. You

Quote
                       
        $defaults['custom_3_-1'] = date('m/d/Y');                                             
        $form->setDefaults( $defaults );   

Kurund
Found this reply helpful? Support CiviCRM

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: how do I set a default date now the date fields have changed?
June 22, 2011, 07:03:39 pm
I could have sworn I tried that but obviously I didn't get it right. Thank you - that works!
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • how do I set a default date now the date fields have changed?

This forum was archived on 2017-11-26.