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 »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Add custom fields in buildForm, overwrite contribution fields with postProcess
Pages: [1]

Author Topic: Add custom fields in buildForm, overwrite contribution fields with postProcess  (Read 1213 times)

leez

  • I’m new here
  • *
  • Posts: 14
  • Karma: 0
  • CiviCRM version: CiviCRM 4.0.4
  • CMS version: Drupal 7
  • MySQL version: MySQL 5.1
  • PHP version: PHP 5.3
Add custom fields in buildForm, overwrite contribution fields with postProcess
September 16, 2011, 06:23:49 pm
We want to use the Contribution form to process offline donations (by credit card, check, or cash), but need to add fields that aren't allowed on the contribution form (receive_date, check_number, payment_instrument, source) and to overwrite the related contribution table fields when populated.  So,

1. How does one properly add a field with the buildForm hook?  Is there a function to do this, and does the .tpl need to be edited for the field to show?

2. Can existing contribution table fields (like receive_date, check_number, payment_instrument, source) be successfully overwritten with the postProcess hook?



Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Add custom fields in buildForm, overwrite contribution fields with postProcess
September 16, 2011, 07:52:36 pm

why dont u use the contribution form from the admin/backend?

check:

http://drupal.demo.civicrm.org/civicrm/contribute/add?reset=1&action=add&context=standalone
http://drupal.demo.civicrm.org/civicrm/contribute/add?reset=1&action=add&context=standalone&mode=live

1. you might want to read: http://en.flossmanuals.net/civicrm-developer-guide/

2. yes

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

leez

  • I’m new here
  • *
  • Posts: 14
  • Karma: 0
  • CiviCRM version: CiviCRM 4.0.4
  • CMS version: Drupal 7
  • MySQL version: MySQL 5.1
  • PHP version: PHP 5.3
Re: Add custom fields in buildForm, overwrite contribution fields with postProcess
September 19, 2011, 05:41:19 pm
Thanks for your response, Donald.

Quote
why dont u use the contribution form from the admin/backend?

If you mean, by the contribution form from the admin/backend, the form to enter a "New Contribution" or "Edit Contribution," we aren't using that because we want to add memberships and process credit cards with the same form.  It seems like the easiest way to have this all in one form is to use the User Contribution form, and find a way to add those missing fields and control where they're stored. 

Quote
check:

http://drupal.demo.civicrm.org/civicrm/contribute/add?reset=1&action=add&context=standalone
http://drupal.demo.civicrm.org/civicrm/contribute/add?reset=1&action=add&context=standalone&mode=live

Both of these links send me to an 'Access denied' page, even when signed in :(

Quote
1. you might want to read: http://en.flossmanuals.net/civicrm-developer-guide/

Thanks for the resource.  I looked through it, but couldn't find anything specific to adding fields through the buildForm function. 

I would very much appreciate any specific direction, or links to examples and/or available functions to use to:
1) add fields with the buildForm function (note: not custom data fields, as those will create new fields in the database), and
2) store the values of those fields in pre-existing contribution table fields with the postProcess function, overwriting what the form would normally write there, like the receive_date.

Thanks!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Add custom fields in buildForm, overwrite contribution fields with postProcess

This forum was archived on 2017-11-26.