Forum Documentation Showcase Pricing Learn more

Showing a dynamic dropdown's existing value

I have several dynamic dropdowns on a page upon which one can add extra information about a record.

If the placeholder for the dynamic dropdown is the text to be shown before a selection is made, then I do not use Dynamic Data and it just says “Choose a content theme”

However if I open a record, that already has the “Content theme” selected, then I can’t get the already selected choice for this Dropdown to show, unless I change the Placeholder to show the Current Page’s “Content Theme”. If I do this then I don’t have any placeholder text when there is no selection.

Can anyone help? Note I had this working before when I was adding this extra data via pop-ups, but I changed from Pop-ups to Pages and am now having this trouble.

Use the same Search for Content_themes first item (or any selection)

24%20AM

Thanks, but I still get an error

Could this be something to do with that field being set as text type, when it should be referring to another data type? I just added ContentIdeaTheme2 and made that actually refer to the field type from which I eventually pull the data anyway.

also if I do “first selection” that just seems to bring back the first option in that field, not the option that has already been selected.

Put another way, is there some way to say Placeholder is:

~text if there is no value selected~, ~Dynamic Data if field already has a value~

?

Create a new field ‘selected_dropd’ and in your Do Search use it. :wink:

Thanks for your help so far @JohnMark I don’t think that is it. Maybe I have something more fundamentally wrong here, but let me resummarise just in case:

I have a data type “Content_idea” and I also have a data type “Content_theme”.

Each Content_idea has a Content_theme which can be set as a field in the Content_idea table (I actually have it twice atm as I am not sure if the field should be type “text” or type “Content_theme”)

When I go to a content_detail page where the type is Content_idea, the Content_idea may or may not already have a Content_theme, which can be set or changed on this page via a Dropdown.

If there is not Content_theme already set, then there should be a Placeholder “Select Content Theme”, and clicking the dropdown shows the possible Content Themes.

If there Content_theme is already set, then the Dropdown should already show the selected Content_theme for that idea.

It seems I can do either/or via the Placeholder - but I can’t get both scenarios to work.

If I would use the Default field for the Dropdown I would have thought it would either be “Current Page Content_idea’s Content_theme” but that doesn’t work. Neither does doing a Search for the Content_theme. I can return the first item as you suggested, but I can’t return the Content_theme that is already associated to this Content_idea.

Hope this makes sense.

There must be a type match between list of options and default value. If all of your options are Content_theme (THING) then your default value cannot be a text. That’s why your Content_theme (text) from the page can’t be a default value.

My suggestion: add a state to any element that is type Content_theme (thing, same as list of options). Make sure that it loads the proper value somehow (when a user selects the value or when you get to that page - url params etc. etc. ). Set up your placeholder normally for when that state is empty. Add this condition or similar to replace the placeholder with a value when necessary.

Kazam_screenshot_00059

Thanks for the help guys. I think I may have a fundamental data type problem throughout my app (thanks to just jumping in and building!) maybe that things are all “text” when they are not meant to be.

I managed to get the Default field to not give an error for the first time using ContentTheme2 field, which has Content_theme as a field type rather than text. So I think I have to go through and look at how all the data is set before I move on.

You have it here. The reason it’s working in the placeholder is that the placeholder is a text type.

Currently you are trying to display a text field where Bubble is looking for a link to the Content_theme data type.

If you are saving the Content_theme into a text field, simply change your Type of choices to text.

image

1 Like

Setting up all your connections as direct links to the thing they represent and not as a text field is the proper way to structure your database. And you will hate yourself later if you don’t.

For instance, if you link to a specific Content_theme instead of storing the text, anything you change about that theme will be automatically updated across your app.

If you store it as text, well, have fun :slight_smile:

1 Like

OK, after a false start, and then going through all my app, I have this fixed.

Thanks for your help and patience guys. The problem was indeed how I had structured data throughout the app - using text instead of database references.

Now it is all working much better.

2 Likes