Reputation: 11
So I am looking at dynamically populating a drop down field in a form with entries from another gravity form. Based on that choice, I will populate a second drop down dynamically based on entries from a gravity form.
More or less I am creating the ability to submit a work order. In that work order I want users to select a piece of equipment then based on that piece of equipment they can select a part.
I have looked at gform_get_entries_args_entry_list as a way of snagging entries, but I am not overly sure how to set it so it pulls from a particular form.
add_filter( 'gform_get_entries_args_entry_list', 'machine' ); function populate_posts( $form ) {
foreach ( $form['fields'] as &$field ) {
$items = gform_get_entries_args_entry_list( 'NOT SURE WHAT TO PUT HERE' );
$choices = array();
foreach ( $items as $GRAVITY FORM ENTRY VARIABLE) {
$choices[] = array( 'text' => $GFEV->THE MACHINE NAME, 'value' => $GFEV ->The Name Field of the machine );
}
$field->placeholder = 'Select a Post';
$field->choices = $choices;
}
return $form;
}
Upvotes: 1
Views: 1846
Reputation: 565
The Gravity Forms Dynamic Population Pro plugin uses the GFAPI:get_entries
function, which you can just directly pass the form ID.
Here's the definition:
public static function get_entries( $form_ids, $search_criteria = array(), $sorting = null, $paging = null, &$total_count = null )
Upvotes: 1