3

I'm contemplating building my own donation page completely, to have full control over the look and feel. The page should send a donation form to the civicrm server that includes the same form fields as the standard donation page does.

Could someone tell me if this approach is viable? Or am I bound to run into problems at some point?

I am especially interested if the form must include some special codes (in hidden form fields) that I would have to generate myself when creating the custom donation page.

2

There IS a viable approach to this, but I don't think it's quite what you're imagining. Sending the form fields to CiviCRM isn't going to load the CiviContributionPage session object, where much of the data is stored.

Approaches you could take include:

  • Use template overrides to change the template. It sounds like you've explored this approach.
  • Build the form using Webform-CiviCRM integration, which gives you much greater control over the look and feel. This requires Drupal.
  • Modify the existing template's HTML after it's rendered using hook_civicrm_alterContent.
  • If none of these will satisfy, instead of submitting all the same form elements, instead use the Contribution API to submit your values.

Check out the Simple Donate extension as an example of folks who took the last approach. They're using AngularJS, so the other options weren't on the table for them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.