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) »
  • How much can be altered in buildForm?
Pages: [1]

Author Topic: How much can be altered in buildForm?  (Read 728 times)

chiebert

  • I post occasionally
  • **
  • Posts: 50
  • Karma: 1
  • CiviCRM version: 4.3
  • CMS version: Drupal 7
  • MySQL version: 5.1
  • PHP version: 5.3
How much can be altered in buildForm?
March 15, 2012, 07:23:29 am
Hi all,

I'm coming to a contribution page from a webform_civicrm submission, have passed in the sid and nid in the URL so have them via $_GET, and now am working in buildForm and buildAmount hooks to manipulate the amounts and other what-nots before submitting. This is for a membership sign-up, but if I get it working I'll be trying it for events as well.

The buildAmount hook is working great - some great examples http://civicrm.org/confluence/display/CRMDOC41/CiviCRM+hook+specification, so thanks. But I'm having a hard time changing, for example, the intro_text of the form. I assume that should be happening in buildForm, and I know I'm targeting the right page (dpm and print_r work as expected), and I think I should be attempting to set $form->_values['intro_text'], but that just ain't working.

Am I barking up the wrong tree?

chiebert

  • I post occasionally
  • **
  • Posts: 50
  • Karma: 1
  • CiviCRM version: 4.3
  • CMS version: Drupal 7
  • MySQL version: 5.1
  • PHP version: 5.3
Re: How much can be altered in buildForm?
March 16, 2012, 11:02:29 am
Follow-up: found the answer to this in the discussion in another of my posts (http://forum.civicrm.org/index.php/topic,23829.0.html). Short answer to changing 'intro_text' (and a few other things in $form->_values) is:

Code: [Select]
$form->assign('intro_text', "<p>Hello World!</p>");
HTH

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • How much can be altered in buildForm?

This forum was archived on 2017-11-26.