We are using Charge and have two custom fields we want to populate when a charge is successful. One works and one doesn't.
We can get it to populate a "pageTitle" field which is pretty standard as a hidden field.
The other field's value needs to change based on the selected planChoice - this one doesn't save anything. The Charge works but the custom field remains blank. Any ideas how to get this to work?
Here's stripped down code:
<form ...>
... charge specific default stuff ...
<input type="hidden" name="fields[pageTitle]" value="{{ entry.title | e }}"/><!-- This is a custom field on the Charge, that does get saved -->
{% set options = {
'planChoices' : {
'two' : {
'label' : "This is a standard Charge field #{entry.title}",
'planAmount' : (ticketPrice * 2),
'fields[ticketInfo]' : "This is a custom field on Charge that doesn't get saved #{entry.title}"
},
...
}
} %}
{{ craft.charge.setPaymentOptions(options) }}
{{ forms.select({
label: 'Plan Choice',
name: 'planChoice',
id: 'planChoice',
options: options.planChoices,
value: (charge is defined ? charge.planChoice),
errors: (charge is defined ? charge.getErrors('planChoice'))
}) }}
... other normal form bits ...
</form>