Hi,
I have a file upload field for images and a lookup field for it.
Normally the lookup field gets the image ID, but i am using this code to convert the ID into the file name:
//Show Image Title
add_filter( 'frm_filtered_lookup_options', 'show_lookup_image_title', 10, 2 );
function show_lookup_image_title( $options, $args ) {
if ( $args['field']->id === '20' ) { // Replace 20 with your actual field ID
foreach ( $options as $k => $option ) {
$title = get_the_title( $option );
$options[ $k ] = esc_html( $title );
}
}
return $options;
}
However, I don\'t want to store the filename, but the image ID.
I want to see the file name from the lookup field because it makes it easier to navigate but I need the entry to save the image ID.
Can anyone help?
Thanks!
Use separate values for the lookup.
Does that work if the lookup is getting values from a file upload field?
It doesn't matter from where the data is derived. Separate values is a standard feature for all lookup fields.
Sorry, I don't get an option for separate values on the lookup fields. I checked the formidable site and it says:
"These settings are visible only if the source field has Separate Values enabled or is a Dynamic field."
<p>Then you’ve probably setup your lookup field incorrectly.</p>
I don't think so.
I get my file IDs from a file upload field and because my lookup is retrieving the data from there it doesn't give me the separate values option.
I would need to get the data from a drop down field but that doesn't work in my case.
Did you delete the last two messages?
Please login or Register to submit your answer