Hi this will be a nice easy one for someone in the know.
I’ve got a couple dropdown menus Cameras and Locations and I have got it so that the list of Cameras depends on the current Location that is set. However, how do i get it so that ALL cameras are shown in the Cameras dropdown, when the user has not yet chosen a location?
Also, how can set a default list item for my dropdowns so that it is already selected on page load? For example, Locations menu to already have the location of Glasgow set, and when the operator selects Edinburgh, Camera 5 should be already set.
Thank you in advance
For question one, go to the conditionals tab and have one condition that says “When location is empty” and set the Choices source to All Cameras. Have a second condition that says “When location is not blank” and set the choices source to Do a Search for Cameras with your constraints set to show the cameras for that location.
Set the default, question two the same way.
Thank you very much Patricia. Number 1 is all sorted now based on your advice.
Unfortunately, I am still struggling on setting the default. I think it will probably work fine if I specify the full name of the camera, but is there a way of just choosing the first available item in the list for that location?
Yes just add :first item after the Do a search for
I thought that but it comes up with an error for FirstItem and for FirstItem’s Name
Hover over the red text, it tells you what the data types are. You need to ensure they match up properly. What it looks like you are asking for is matching up a text with a camera datatype. Do you have a “name” parameter in your camera datatype?
Yes, there is a Name parameter for the cameras.
It’s a good idea to learn how to debug for yourself and this is a great opportunity. Look at the red text top right that says “n Issues” and you will see an explanation of why Bubble thinks your value is not valid. Also, check the type of your dynamic choices - is that a text or a camera?
It looks to me from the screenshots that your dropdown type is Camera and the Default Value is Text. They are incompatible. Have you tried dropping the ‘name’ piece and just staying with :first item as I suggested earlier?
The default value is not the caption. The caption you have already set to the name = text. So just set the default value to the camera. Does that make sense?
I fixed it up for him, it’s all good
Hi @patricia, thank you very much for taking the time to try and help me out. I hadn’t realised the issues feature gives further detail about what might be causing a problem. I’ll definitely look there in the future to see if I can solve the problem myself. @troy.roberge kindly helped me out on this occasion and I now see where I was going wrong.
@AlexKehoe - that was exactly why I mentioned it. I know that when I found it I was able to help myself most of the time. There is not always someone around when we need them