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) »
  • best way to get Form field values in postProcess hook
Pages: [1]

Author Topic: best way to get Form field values in postProcess hook  (Read 979 times)

nicolas

  • I post occasionally
  • **
  • Posts: 92
  • Karma: 6
    • cividesk
  • CiviCRM version: 4.4 LTS
  • CMS version: Standalone (yep)
  • MySQL version: 5.1
  • PHP version: 5.3
best way to get Form field values in postProcess hook
March 02, 2013, 04:04:16 pm
There is little documentation on what are best practices to read form field values in the postProcess hook. I have found you can use:
- the $_POST array
- $form->getVar('_submitValues'), which returns an array similar to $_POST
- $form->getElement('foo')->getValue(), which returns individual field values

Which is the more reliable / recommended?

Thanks.

PS. I will update the corresponding wiki page with the answer.
cividesk -- CiviCRM delivered ... your way!

lolas

  • I post frequently
  • ***
  • Posts: 134
  • Karma: 9
    • Freeform Solutions
  • CiviCRM version: Several
  • CMS version: Drupal
  • MySQL version: 5.1+
  • PHP version: Several
Re: best way to get Form field values in postProcess hook
March 04, 2013, 10:05:32 am
In the past I have been told to use the exportValues function. I could have sworn I updated the wiki at the time but I don't see it now.
It must have been lost during a version update.
It is mentioned here: http://wiki.civicrm.org/confluence/display/CRM/Development+Exercises
Freeform Solutions provides technology and management consulting, website and database development, and managed internet hosting solutions for not-for-profit organizations (NFPs).

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • best way to get Form field values in postProcess hook

This forum was archived on 2017-11-26.