Hi there,
I’ve got a long list of Pin codes in a referenced database. I want users to input their PIN Code by text
input field rather than drop-down field as it is really long list.
Exactly what I want is, user will type the PIN code. Matching PIN codes from referenced database will be suggested. Then user will select it.
But whenever I try to connect a text input field to referenced field, it doesn’t allow me. Is there any option for this? Please help. Thanks.
You can’t and that is why it is a dropdown element on this page here on reference fields.
https://support.wix.com/en/article/about-reference-fields-in-database-collections
Connecting Dropdown Elements to Reference Fields
You can connect a dropdown list element to a reference field. This means that the items in the dropdown list automatically come from the Main field in the referenced collection. If you do this on an input form, the value selected by your visitor gets saved to the reference field in your collection.
If you want to use a user input to get a value to search for, then you need to be using the dataset that holds the pin codes and not the reference field from another dataset as that uses the ID field of the row in the parent database.
You can look at using include.
https://www.wix.com/corvid/reference/wix-data.WixDataQuery.html
https://www.wix.com/corvid/reference/wix-data.WixDataQuery.html#include
Or query / queryReferenced for more as well.
https://www.wix.com/corvid/reference/wix-data.html#query
https://www.wix.com/corvid/reference/wix-data.html#queryReferenced