This help desk is no longer actively support. We have switched to a ticketing system to more smoothly manage support, and free up development time. Your newly created tickets won't be available here. You will instead have an email history of your new tickets.

We are working on moving everything current and helpful from public tickets into the docs. This will be a long process and in the meantime, public tickets will remain searchable.

Your private tickets will remain available to you indefinitely. See your old tickets.

Help Desk

Dynamic Dropdown

Labels

This Ticket is public

Notifications

Hi All

I'm sure I've seen somewhere in the support tickets / documentation how to sort my problem, just can't seem to find it!

Is it possible to have a Dynamic Dropdown list more than one field, e.g. clicking gives you... Field 1, Field 2, Field 3 listed in the dropdown.

Specifically...

I have a voyages form. In the form are fields for boat name, date, and skipper etc.

On my second form I have a Dynamic dropdown listing all the boat names. Ideally I'd have the dropdown listing the boat name, date and skipper so I can select the correct entry.

Is this possible????

Thanks so much

Matt

 

Hi, Matt --

We have a code example for showing two pieces of info.  You can adapt it to show three, if you like.

https://formidableforms.com/knowledgebase/frm_setup_new_fields_vars/#kb-display-two-fields-in-a-dynamic-field

Wow, super quick response! Thanks Laura!!! :-)

If anyone else needs it this is the code I'm using to add three fields into the dynamic dropdown.

 

// Pull three fields together from the Voyages form and display them together on the major incident form
add_filter('frm_setup_new_fields_vars', 'customise_voyages_dropdown', 25, 2);
function customise_voyages_dropdown( $values, $field ) {
if ( $field->id == 1031 && !empty( $values['options'] ) ){//Replace 125 with the ID of your dynamic field
$temp_values = $values;
$temp_values['form_select'] = 320; //change 30 to the id of the second field you want to show in your dynamic field
$temp_values2['form_select'] = 984; //change 30 to the id of the second field you want to show in your dynamic field
$field2_opts = FrmProDynamicFieldsController::get_independent_options( $temp_values, $field );
$field3_opts = FrmProDynamicFieldsController::get_independent_options( $temp_values2, $field );
foreach ( $values['options'] as $id => $v ) {
$values['options'][ $id ] .= ' '. $field2_opts[ $id ] . ' (' . $field3_opts[ $id ] . ')';
}
}
return $values;
}

Hi, Matt --

My pleasure!  Thanks so much for sharing this helpful code with others!

This is a private ticket, so people won't be able to see it.  You can make it public by editing your first message and unchecking the private checkbox.

We have a place for users to share their awesome solutions with the rest of the community.  If you have a moment, you may want to add a tip with your code there:

https://community.formidableforms.com/tips-tricks/

Will add it to the tips & tricks. :-)

There wasn't a private checkbox for me when editing but happy for it not to be Private.

Thanks again for the quick and helpful pointer!

Regards

 

Matt

Hi, Matt --

Thanks for letting me know about that.   I've made the ticket public.  Thanks again for sharing!

No worries

I've also added it (with better formatting) to the tips & tricks community section.

https://community.formidableforms.com/help-desk/show-more-than-1-field-in-a-dynamic-dropdown/

Ticket closed.