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 »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Accessing data within an array using getvar in buildForm hook
Pages: [1]

Author Topic: Accessing data within an array using getvar in buildForm hook  (Read 1650 times)

ldjosh

  • I’m new here
  • *
  • Posts: 13
  • Karma: 1
  • Developer. Ninja. Gentleman.
Accessing data within an array using getvar in buildForm hook
May 06, 2010, 02:02:00 pm
ok, so here's the thing... I'm trying to get the event title inside the registration form. Based on the title (or the suffix actually...) i'm going to set certain values and manipulate the form itself, but I need to know the event title first.

I'm debuging it like so right now:

Code: [Select]
function joomla_civicrm_buildForm( $formName, &$form ) {

echo "<!-- Begin Debug   ";
 
 echo $form->getVar('_values');
   
 echo " End Debug -->";
}

the output is an array, but as is, it just returns the word ARRAY

A var_dump of the page shows
Code: [Select]
[_values] => Array
                (
                    [event] => Array
                        (
                            [id] => 13
                            [title] => Voice of The Nerds 2010 - Single
                            [event_title] => Voice of The Nerds 2010 - Single
                            [summary] => Come hear about how technology is making everyones life easier, and your job obsolete. Robots will be doing your essential job functions in the near future, so you won't have to! Guest speakers include Josh Clark, Josh W, Travis and more!
                            [description] => <p> ....(Lots more here...)


that it's a nested array.
I need to access that title or event_title. Any ideas?




Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Accessing data within an array using getvar in buildForm hook
May 06, 2010, 02:23:30 pm
What's wrong with:

Code: [Select]
$values = $form->getVar('_values');
echo $values['event']['title'];

?
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.

ldjosh

  • I’m new here
  • *
  • Posts: 13
  • Karma: 1
  • Developer. Ninja. Gentleman.
Re: Accessing data within an array using getvar in buildForm hook
May 07, 2010, 08:25:53 am
Well... nothing today... but yesterday that didn't work.
 :P
Thanks Hershel

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Accessing data within an array using getvar in buildForm hook

This forum was archived on 2017-11-26.