Forum Academy Marketplace Showcase Pricing Features

Limiting a dropdown to one choice only then hiding it

I am trying to record a vehicles fuel records. As well as saving the data to the Vehicles fuel “type” so the user knows how much they have spent as well as the fuel economy of the vehicle I want to also record it as an expense type as well… All good so far and I have been able to achieve this.

Each expense type has a Category and Sub Category. In the case of a fuel expense it is “Fuel” as a category and petrol or gas or diesel as the sub category. Again I have been able to save this data correctly by adding an expense category group in the new fuel popup and having some dropdowns

My problem is that I do not want the user to go to the hassle of choosing the expense category from the dropdown as the expense category will always be “Fuel”, nor do I want them to go to the hassle of entering a description which will also always be “Fuel”. The only thing they really need to choose is the sub category of Petrol or Diesel

My preference would be to limit the Category dropdown and Description fields to Fuel only and be hidden so the user does not have to go these extra unnecessary steps

How would I go about this???

Tough to tell if these will work with your current setup without seeing everything, but can give them a try.

Depending on the workflows you currently use to save the data, You can get rid of the Fuel inputs, and just input Fuel in the correct fields when you do the workflow. So when you save the Data, instead of “Expense = Dropdown’s Value” You can simply save “Expense = Fuel” (just type it in).

Or you could put the dropdown and input’s default values as Fuel

You could disable both inputs and set their values yourself. Depends on what else you’re wanting to do from there. If this information is being saved, then you would also know where to set the values to Fuel in the workflow. Is this more of a UI thing so that users can see it’s been pre-filled for them? If so, the sources of these inputs could still be pulling from your database and you can define the initial content, but disabling them ensures they don’t get changed.


Gaby | Coaching Bubble

2 Likes

Thanks @romanmg and @gf_wolfer for your suggestions. My problem is really with the workflow and saving the data as I need to save it for the reports. I have tried both your suggestions but I can not get either to work. I can not type in “Fuel” - nothing happens when I do and I can not proceed. If I have a static choice for the dropdown as the workflow will then show it as an “inappropriate type”.
Here is a link to a copy of my editor https://bubble.io/page?type=page&name=fuel&id=vehiclebasedtravel2&tab=tabs-1
Popup is called Popup New Fuel

Hey there,

I fixed it up for you and only changed a few things:

  1. The source of the Category dropdown just needed to go directly to the Fuel category, so I set a constraint on the Category search to only return Categories whose Name = Fuel, which will only show the one you need. I disabled the input so that users don’t change it, and since it’s now linked to the correct Category, it should save.

  2. I cleaned up the source of the subcategory dropdown to simply be Category Dropdown’s subcategories.

  3. I set the initial content of the description to the text “Fuel” and disabled that input as well since that’s the pre-filled you’re wanting. Looks like your workflow to save this field is correct. (Alternatively, you could also type “Fuel” directly into the field in the workflow to save since it will always be Fuel in this case).

Let me know if this solved it for you!


Gaby | Coaching Bubble

Thanks so much @romanmg. This is such a great community for which I will forever grateful. It appears though that I can not choose anything in the sub category as it appears the fuel category is not coming up.

If I change the input back to enabled and give it a default value at least I can get Fuel to come up as the only category which is satisfactory

.

From a UX point of view though I would prefer if you did not have to choose it at all if at all possible. Any further suggestions???

Oh yes, copy and paste the choice source expression to the default value and add “:first item” at the end. See if that helps.

Thanks @romanmg. That did it. Wonderful :grinning:

1 Like