Created
June 30, 2017 01:29
-
-
Save Shelob9/cb9182fbbee37e0445d3af566aec5105 to your computer and use it in GitHub Desktop.
Code examples for using Caldera_Forms_Entry_Field::insert() and Caldera_Forms_Entry_Update::update_field() to add and update field values of an entry programatically
This file contains 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
<?php | |
/** | |
* Add a Caldera Forms Field value programatically | |
*/ | |
//IMPORTANT, Change your field and form IDs. | |
$field = Caldera_Forms_Field_Util::get_field( 'fld4223', Caldera_Forms_Forms::get_form( 'cf1345' ) ); | |
$field_item = array( | |
'entry_id' => 42, | |
'field_id' => $field[ 'ID' ], | |
'slug' => $field[ 'slug' ], | |
'value' => 'Some Value' | |
); | |
//insert new field value | |
$field = Caldera_Forms_Entry_Field::insert( $field_item, true ); | |
/** | |
* Update a Caldera Forms Field value programatically | |
*/ | |
//change field value | |
$field->set_value( 'Some other value' ); | |
//save change | |
Caldera_Forms_Entry_Update::update_field( $field ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment