Choice Control - edit a record

Are you using our SaaS platform (Baserow.io) or self-hosting Baserow?

Self-hosted

If you are self-hosting, what version of Baserow are you running?

version 1.33.0

If you are self-hosting, which installation method do you use to run Baserow?

Docker - newest version

What are the exact steps to reproduce this issue?

I created a database with two tables, a main records table and then a table with options for a Choice control on a form that I then linked as a field on the main table. I created a form with a table control linked to the main records table. I added an edit button with a Choice control on the edit form to allow for editing the record. The current value of the field shows up with no trouble in the table control but when I reference it in the Edit form, I can’t set the Choice control to the value. I have attached some screenshots.

The “Edit form” screenshot shows the Select control as “Make a Choice” instead of the value already set for the record. As seen in screenshot “Main Table”, the value can be read as it is populated properly here.

Thanks!

Attach screenshots, videos, or logs that demonstrate the issue.






Hi,

The Choice element is to allow users to select a value that is represented in the database as a single or multiple select field. If you want to work with linked tables, my suggestion would be to use the Record Selector element.

This element has records from one table as the data source and can be used in a form to insert linked record in the linked table.

You can check the Task Management template to see an example of this technique. The Task details page has a form with the Record selector element to select all the Equipment for the selected task.

Yes, I understand what a Choice control is for. What I don’t understand is why I can’t set the value to the already selected value for the field. If the user creates a new record and uses the choice control to set values in that record, I would think if they choose to edit that record the Choice controls will be set to what they chose when adding that record and not reset to no value at all. What’s the point of the Value field for the Choice control if it is ignored? I will look and see if your suggestions meets the need but this seems like a bug.

The Value field is ignored because it cannot find a matching value in the options defined by Option values. I created a similar example

A table with Persons

A table with Options

An application with a detail page for each Person. This page has 2 data sources:

  1. Getting a single record → for the person (depending on the passed parameter)
  2. Getting multiple records → for the options

My choice element has the following configuration:

  • Value → referring to the value of the Person
  • Option names → referring to the Name field of the Options table
  • Option values → referring to the Id field of the Options table

Running the application shows me the selected item and I can modify the options

Storing the updates:

The reason why I recommend the Record Selector element for this is because that element also allows searching the dropdown list and is easier to implement.

Thank you for that, but I am having a hard time recreating the behaviour displayed. Here is what I am seeing:

The behaviour I would expect is that would be the value set by the specified ID in the Value attribute of the control. Each time the user would change the record, they would have to select all the set values again each time they do an edit and if they don’t choose something they get the error:

image

It adds a whole bunch of clicks.

Just as a follow up, if I set the placeholder for the control the right value does appear in the Choice control so from that I can tell it can find the value I am looking for but it isn’t actually set to anything. If I change one option and don’t change the one with the place holder it will not allow the record to be updated until the user selects the record again:

So that shows the value is pulled in as a placeholder:

Thanks!

I think there is only one small details to fix. The Value property refers to Lab Locations > [All] > id, but there is only one value that can be selected since the checkbox Allow multiple values is not checked.

If this is the case - that you only want a single value - you need to adjust the value property to Lab Locations > [0] > id

Thank you Frederick, that seems to have worked although it is intermittent. It doesn’t load every time for some reason:

First time clicking edit:

Go back to the main form and click edit again:

That time it loads and behaves as expected. Is there anything else I can look at for that behaviour?

Thanks!

You can display the value for the choice element in a text element and see if there is any difference between the first and second time you enter the edit page.

Hi:

The id is definitely correct on the first load but it isn’t showing in the choice. Odd loads don’t load anything but even loads do. So first time, it is “Make a choice” but second time it is the actual value. Third time “make a choice” and so on.

First load:

Second load:

Thanks!

Just an FYI, I am able to recreate the issue in my test instance as well as in the Risk Management template provided by Baserow.

On which page of the template?

Registered Risk Details.

This looks indeed like a bug. I created an issue for it: Choice element is not showing current value when multiple values is turned off (#3602) · Issues · Baserow / baserow · GitLab

That’s great, thank you very much for that Frederik and for your time spent on this ticket.

Cheers!