4

A client is using webform-CiviCRM for a contribution page. Due to pro-rating and other factors, each contributor needs to pay a unique amount - and thus the webform has the exposed "Contribution Amount" element that can accept an amount from a user.

How can I pre-fill this Contribution Amount using a custom field value? The webform Default Value can't be set to a token for a custom field that has the amount (returns "This is a CiviCRM currency field. Default value must be a number.", even if the field is an integer or a number.

It might also be possible to attach the $ amount to the URL as a parameter?

2 Answers 2

3

Just adding to this -> this is now possible (since today: many thanks for Fuzion for re-asking this question and helping to see it through!); we had to relax a form_error that was preventing tokens to be injected in the default field for contribution_total_amount;

You can now do:

/webform-civicrm-example?civicrm_1_contribution_1_contribution_total_amount=120

and if you have configured your Contribution Amount -> default as:

[current-page:query:civicrm_1_contribution_1_contribution_total_amount]

Then it will fetch that $120 -> and give you:

enter image description here

2

You can try to add the value in a URL to prefill it (if that is what you are asking). If the URL is: /paymentform

I think you could then send a URL such as /paymentform?amount=25 with a default value in the amount field of [current-page:query:amount]

Aside: If you are sending these URLs from a CiviMail mailing (or sending an email to a contact through CiviCRM) and have the amount information in a custom field, you could prefill the amount value in the URL via a token for that custom field value.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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