Dropdown values and autobinding

Hi Everyone,
New Bubbler here with a question about dropdowns. I’m trying to store the data from a dropdown in a text field. Here are is the setup of the data:

The first table stores data about agencies:

Table Name: agency
Field Name: agencyName
Field Type: text

The second table stores data about appointments including a field for the agency:
Table Name: appointment
Field Name: agencyName
Field Type: text

I have created a page called appointment where I placed a drop down called cboAgency (see below).

image

I would like to autobind the data in this dropdown to agencyName, but rather than displaying the option to bind it to agencyName, it only gives me the option to create a new field.

Does Bubble view the source as an object or as a field’s value? I’m not sure why I can’t bind this properly.

Any help would be appreciated.

I believe the reason you cannot autobind to the field agencyName is because the dropdown’s Type of Choices has been set to the Data Type of Agency, while agencyName is a text.

One way you might be able to fix this is if you change your Type of Choices to text, and change your choices source so that it is “Search for agencys: each item’s agency Name”, then you should be able to autobind to agencyName.

Hi Leo, based on the information you’ve given, I’m not entirely sure why you want to use auto-binding here. I think you’re probably looking to create an appointment, and assign an agency to that appointment?

In this case, you want the dropdown to be inside a parent element (probably a Group) that has the data type you’re storing the appointments in. For now, let’s call that separate data type Appointment.

Within that data type, you’d want a field of type Agency. You could then auto-bind this dropdown to that, meaning that every time you change the value of the dropdown, you’ll automatically change the Agency field in that Appointment.

Alternatively, if you want that field to be more customisable, you could make a text field in your Appointment data type. Then, you’d want the choices source to be Search for agencys: each item’s agencyName. Because you’re then providing the dropdown with a list of texts, it will auto-bind whichever text you select to the text field you’ve created in your Appointment data type.

Does that make sense for what you’re trying to achieve?

Hi Chris,
Thanks for the reply. I’ve followed your instructions and it seems to be working as intended.
Thanks for the assitance!

Hi Gregor,
Thanks for the quick reply. I have seen other options that suggest adding a parent group as well. My thoughts were that by autobinding the control to a field, it would negate the need for a parent group.

Am I wrong about this? Does the parent group add other functionality that I may need in the future?

Thanks again.

It doesn’t need to be a group, but the auto-binding is on the parent element’s thing. So if you were auto-binding stuff to an Appointment, having a Group with type Appointment as the parent thing would allow you to have multiple inputs that auto-bind to various fields in that Appointment (start time, appointment length, location etc)

Ah. So by having the group bound to appointment, I could have a large layout of the group with multiple elements in it all bound to the parent.
Correct?

yes that’s correct :+1:

1 Like

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