Body: <p>We are using Charge and have two custom fields we want to populate when a charge is successful. One works and one doesn't.</p>
  
  <p>We can get it to populate a "pageTitle" field which is pretty standard as a hidden field.</p>
  
  <p>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?</p>
  
  <p>Here's stripped down code:</p>
  
  <pre><code>&lt;form ...&gt;
      ... charge specific default stuff ...
  
      &lt;input type="hidden" name="fields[pageTitle]" value="{{ entry.title | e }}"/&gt;&lt;!-- This is a custom field on the Charge, that does get saved --&gt;
  
      {% 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 ...
  &lt;/form&gt;
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-04-17T15:29:38.587Z
Comments.Text: When you google a problem and find your own un-answered question from 8 months ago...
Comments.UserDisplayName: Matt Wilcox
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-05-13T01:49:07.693Z
Comments.Text: It's like a sad time machine which I have visited a few times to many.
Comments.UserDisplayName: Vin
Tags: <plugin-charge>
Title: Populating a Custom Field via a Plan Choice in Charge?
ThreadText: # Populating a Custom Field via a Plan Choice in Charge?
  
  (Asked by: username_0 on 2017-08-16)
  
  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>
  
  ```
  
  **Tags:** plugin-charge
  
  > **Comments:**
  > **username_0**: When you google a problem and find your own un-answered question from 8 months ago...  
  > **username_1**: It's like a sad time machine which I have visited a few times to many.  
  
  ---
  
  ## 0 answers
  
  