Created
April 20, 2016 11:03
-
-
Save leepettijohn/600b0d3b47392bf9fbf162a9d6a2bf75 to your computer and use it in GitHub Desktop.
Update a list field in Gravity Forms
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Update a List field in Gravity Forms | |
| //Change the '6' at the end to the correct form id | |
| add_action('gform_post_submission_6','update_list',10,2); | |
| function update_list($entry, $form){ | |
| $entry_id = $entry['id']; | |
| //print_r($entry); | |
| $list_values = array( | |
| array( | |
| 'Column 1' => 'one', | |
| 'Column 2' => 'two', | |
| 'Column 3' => 'three', | |
| ), | |
| array( | |
| 'Column 1' => 'i', | |
| 'Column 2' => 'ii', | |
| 'Column 3' => 'iii', | |
| ), | |
| array( | |
| 'Column 1' => '1', | |
| 'Column 2' => '2', | |
| 'Column 3' => '3', | |
| ), | |
| ); | |
| $list_value = serialize( $list_values ); | |
| //Change the '9' to the correct field id | |
| GFAPI::update_entry_field($entry_id,9,$list_value); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment