The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group

Slack Signup
Newsletter Optin
Help Desk

Show more than 1 field in a Dynamic Dropdown

Labels

This Discussion is public

Notifications

A tip to to show many fields in a Dynamic Dropdown instead of the default one entry to select from.

For example when you are using it to select Surname field and you have multiples of the same surname; this code added to Functions.php or custom plugin allows you to have the dropdown show "Surname, Firstname, Date of birth" to select from...

add_filter('frm_setup_new_fields_vars', 'yourfunctionname', 25, 2);
function yourfunctionname( $values, $field ) {
if ( $field->id == 1031 && !empty( $values['options'] ) ){ //Replace 1031 with the ID of your dynamic field you want to change
$temp_values = $values;

$temp_values2['form_select'] = 320; //change 320 to the id of the second field you want to show in your dynamic field
$temp_values3['form_select'] = 984; //change 30 to the id of the third field you want to show in your dynamic field

$field2_opts = FrmProDynamicFieldsController::get_independent_options( $temp_values2, $field );
$field3_opts = FrmProDynamicFieldsController::get_independent_options( $temp_values3, $field );

foreach ( $values['options'] as $id => $v ) {
$values['options'][ $id ] .= ' '. $field2_opts[ $id ] . ' (' . $field3_opts[ $id ] . ')';
}
}
return $values;
}

Hope it helps others

Regards

Matt

Discussion closed.