DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

J has posted 6 posts at DZone. View Full User Profile

CiviCRM drop-down selector for payment_instrument field of form

06.21.2012
| 4856 views |
  • submit to reddit
// Drop-down selector for payment type (credit card, check, etc) - add this to preProcess() function of the controller code
$this->add('select', 'payment_instrument_id', 
                  ts( 'Payment method' ), 
                  array(''=>ts( '- select -' )) + CRM_Contribute_PseudoConstant::paymentInstrument( ),
                  false, array( 'onChange' => "alert('Add an onchange when a selection is made - perhaps using the built-in showHideByValue?');"));

// Show drop-down selector -- add this SMARTY code to the template code
{$form.payment_instrument_selection.html}