Answers.Body: <p>To clarify this scenario: you must be talking about muti-record <em>contact</em> custom data and not <em>contribution</em> custom data (which only supports single-records currently).</p>
  
  <p>I recommend you use <a href="http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_postProcess" rel="nofollow">hook_civicrm_postProcess</a> to insert code to store the data on form submission. This code inside your implementation of the hook should use the CustomValue API to save the data. You'll find documentation and examples of how to use it in the API explorer.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-01T13:19:18.393Z
Answers.Text: I think I'm getting confused because the hook examples don't use the API. Conversely, the API examples don't appear to be implemented via a Civi hook (it always seems to be within Drupal modules). The example in your link writes straight SQL, and other hook examples in the docs prefer to skip the API and use BAO and DAO directly.
Answers.UserDisplayName: Nicholai
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-01T13:23:48.717Z
Answers.Text: The hook docs could use updating.
Answers.UserDisplayName: Coleman
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-01T12:44:55.807Z
Answers.LastActivityDate: 2015-04-02T23:26:01.217Z
Answers.LastEditDate: 2015-04-02T23:26:01.217Z
Answers.UserDisplayName: Coleman
Body: <p>When I attach a multi-record custom field group to a profile for contribution pages, Civi only allows visitors to enter the fields once. I've read through jira a bit and see that the capability isn't there currently. Is there a simplified example showing how to use API v3 (preferably PHP, but any method is fine) in a way that adds a multi-record custom field group at the end of a contribution (i.e. after payment processing is complete)? </p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-04-01T08:03:03.597Z
Comments.Text: If using Drupal, you might be able to achieve this using a webform and the webform_civicrm integration module
Comments.UserDisplayName: Graham
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-04-01T12:43:34.017Z
Comments.Text: @Graham that would work - why not add it as an answer
Comments.UserDisplayName: Coleman
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-04-01T12:56:18.190Z
Comments.Text: Webform_civicrm would solve so many problems for this client. Unfortunately they're on Wordpress, and it's a pro bono gig so I'm trying to find a way to solve their need with the smallest amount of custom code. The examples are a bit too generic for me to grasp; they show the mechanics of an API call, but each example is isolated and lacks context so I'm seeing the "how" but not the "why" or "when".
Comments.UserDisplayName: Nicholai
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-04-03T18:20:07.543Z
Comments.Text: My impression is that they can enter more than once but they have to be submitted one at a time. I have a site where everyone is walking and they have been submitting their miles each week through a normal form in Joomla.
Comments.UserDisplayName: Elin
Tags: <api><profile><custom-fields>
Title: Example of adding multi-record custom fields to a contact via API
ThreadText: # Example of adding multi-record custom fields to a contact via API
  
  (Asked by: username_0 on 2015-03-31)
  
  When I attach a multi-record custom field group to a profile for contribution pages, Civi only allows visitors to enter the fields once. I've read through jira a bit and see that the capability isn't there currently. Is there a simplified example showing how to use API v3 (preferably PHP, but any method is fine) in a way that adds a multi-record custom field group at the end of a contribution (i.e. after payment processing is complete)?
  
  **Tags:** api, profile, custom-fields
  
  > **Comments:**
  > **username_1**: If using Drupal, you might be able to achieve this using a webform and the webform_civicrm integration module  
  > **username_2**: @username_1 that would work - why not add it as an answer  
  > **username_0**: Webform_civicrm would solve so many problems for this client. Unfortunately they're on Wordpress, and it's a pro bono gig so I'm trying to find a way to solve their need with the smallest amount of custom code. The examples are a bit too generic for me to grasp; they show the mechanics of an API call, but each example is isolated and lacks context so I'm seeing the "how" but not the "why" or "when".  
  > **username_3**: My impression is that they can enter more than once but they have to be submitted one at a time. I have a site where everyone is walking and they have been submitting their miles each week through a normal form in Joomla.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2015-04-01. Score: 1 | Accepted answer
  
  To clarify this scenario: you must be talking about muti-record *contact* custom data and not *contribution* custom data (which only supports single-records currently).
  
  I recommend you use [hook\_civicrm\_postProcess](http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_postProcess) to insert code to store the data on form submission. This code inside your implementation of the hook should use the CustomValue API to save the data. You'll find documentation and examples of how to use it in the API explorer.
  
  > **Comments:**
  > **username_0**: I think I'm getting confused because the hook examples don't use the API. Conversely, the API examples don't appear to be implemented via a Civi hook (it always seems to be within Drupal modules). The example in your link writes straight SQL, and other hook examples in the docs prefer to skip the API and use BAO and DAO directly.  
  > **username_2**: The hook docs could use updating.  
  
  ---
  
  