I am building a review site and I am hitting a wall on a very simple flow. In the add review page, a user needs to select a company. So I have this setup:
I have a search input for the company, a website input and an address input.
Here is what I would like to do:
- At first, the only input displayed is company name and the user starts typing. I would like to use the autocomplete feature of the searchbox to help the user select easily an existing company
- if the company exists, then the user selects it and a button next is displayed, I then send the name of the company in a parameter to the URL to the next page
- if the company is not available via the autocomplete, then the two additional inputs are displayed. When the user finished to input all data, a next button is displayed which starts a workflow for the creation of a new company and transfer the data via a url parameter to the next page
I am able to do 2 and 3 independently but I am unable to perform the automatic selection of each workflow. I have tried to use a conditional display for the two inputs based on the input in the searchbox (only if the searchbox value is empty) but given that the searchbox starts empty these fields are always displayed when I start the page.
I am stuck on the logic and would really appreciate some help!
Thank you very much,