Smart Field Reference Typeahead

Hey Forest,

Here’s what I’m trying to do: I have a smart field that I’m using as a reference field on a collection. However I can’t really use the typeahead, the only field that seems to work is the id. I basically want to be able to search this smart field that I’m returning on the typeahead. So essentially someone could type out the id or the product name, etc. and it should pop up. Here’s how it currently is.

Thank you in advance!

image

Hello @Arda_Yurdakul ,

Can you try to search on fields separately? Here’s an example that you can find in our documentation.

Please let me know if this helps!

Hey @mian,

Thank you for the fast reply! The logic is working, however I mainly need to use some related data for search. Namely, I need to be able to search on product name which is related to the collection the smart field is on(productPrices) with 1:n. Below you can see how I get said data to put on the smart field value. How can I pull that related data within the search query?

Do you have the possibility to click on Try an extended search as mentioned in the documentation? (Don’t forget to modify the routes as well as stated in the example.)

@mian This didn’t seem to work for the typeahead, another solution for my case could be changing the widget from a typeahead to a dropdown. Is this possible on a smart action form field?

Hello @Arda_Yurdakul

I’m sorry but after looking into it, searching on related data as you want to do it is not supported at the time.

I’ll share this need with the team and try to have it added on our roadmap.

Regarding the dropdown solution, it may help but not entirely.
Please have a look at this documentation page: https://docs.forestadmin.com/documentation/reference-guide/fields/customize-your-fields/edit-widgets#dropdown

Look for “dynamic mode”, and “enable search”. This may help.
Please that in your case, you might need to fetch the whole product table to generate all possible values.