Set Initial Content of input based on a choice from a list

Hi Bubble forum,

For some hours I have been trying to get my head around in building a own dropdown list function which shows a list of names and images ( in this case country flag’s and names)

I used the instructions below which I found on the Bubble forum, but I am stuck at step 5

  1. Use an input field instead of a search box.
  2. Build a simple RG in a Group just below the input field that looks like a dropdown and put your image and text in the RG just as normal using a Do a Search for. Then set the group to be hidden on page load and put a condition on it that it is visible when the input field is focused.
  3. Drop the Search& AutoCorrect element onto the page (it will be invisible in run mode) and point it to the input box and tell it which fields to search.
  4. Go back to the RG and set a condition ‘When input field is value is not empty’ then Data Source = Search & AutoCorrect’s matches.
  5. Now build a simple workflow that when a user taps an element in your ‘fake’ drop-down, that the value of the input field is set to that cell.

What I am trying to do is set the input’s initial content on the choice made from the repeating group. I have been trying to do this with custom states but for some reason I can’t get it working, when I try to make a choice from the dropdown list, the input’s content remains empty. Please see some images below of my settings

Custom State setting

Workflow setting ( when you click on a specific cell in the RP group)

How it looks live

Any help is very much appreciated, thank you!

1 Like

In order to alter the ‘Initial Content’ of an input after it has already been edited is to either reset the input itself or put the input in a group and reset the data for the group. Both of those are available built in workflow actions. If the Initial content of the search bar is set to a custom state then when you reset the group or input after the value of the custom state has changed, you will see the updated value in the input.

1 Like

hey William

thanks for your reply. I just dont get it to work yet, could you please check the screenshots below if you see if I am doing something wrong?

I have set a custom state as text on the input and this will be activated when you click a specific cell on the repeating group, in each RP cell there is a group with an flag image and country name, however I just need the initial content of the input to change in the country name

thans a lot in advance!



k

Can you allow editing or atleast to view and message me a link to the editor?

apologies for the later reply, please find the editor link below:

Would appreciate it if you can take a look!
Thanks!

Hey, I got it working. It wasn’t working because you had a conditional on the Country Multi Choice Group to only show when the Country Input is focused. So when you clicked on the repeating group cell it unfocused the input first and hid the whole group before activating the workflow. You may want to use another method from the one I used to show and hide the group but at least now you know what the error was.

Hey William!

Fantastic help, thanks a ton. Any chance you can also point me in the right direction on how users could potentially correct the choice they made in case of a wrong selection? So far when I am trying to correct the country selection, the repeating group seems to be invisible .

Please use this new link for editor: https://talentflows.bubbleapps.io/version-test/input?debug_mode=true

Tuely appreciate your help so far William! thank you

I noticed that. It was because of your conditional on The repeating Group to change the Data Source to SearchAutoCorrect or something like that when Country Input’s value is not empty. I’d say remove that conditional and everything will work fine.

1 Like

Fantastic, worked like a charm William. Thanks a lot!

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.