In the contact form, I need to add a new button "Save and add Contribution" that, when pressed:
- save the current contact data
- redirect to the "New contribution" page, possibly with the contact already selected
How can obtain this? Thanks
CiviCRM Stack Exchange is a question and answer site for administrators and users of the CiviCRM Constituent Relationship Management software. It only takes a minute to sign up.
Sign up to join this communityIn the contact form, I need to add a new button "Save and add Contribution" that, when pressed:
How can obtain this? Thanks
You can solve this by writing some custom code in an extension. You can use a hook to insert this butoon on the contact form which does what you want to do.
The way suggested by Jaap is correct. After creating a new extension in the buildForm hook I've inserted the following button:
$form->add('submit', 'SaveAndContribution', ts('Save and Add Contribution'));
and his template. The form is now complete.
At the moment, anyway, I'm not able to distinguish which button was pressed. I had a look at the postProcess hook, but without result.