Creating an action to reflect checkboxes actual state

Hello!

I am fairly new to Glide. In my application, when I create a project, I have sections with checkboxes. I would like to add a button to sync the checkboxes in one section to the ones in another section below. For example, when Checkbox 1 is checked, i would like Checkbox A to be checked as well when the button is clicked (and when Checkbox 1 is unchecked, Checkbox A is also unchecked when the button is clicked again). For that, I created an action to set columns value and I linked that action to my button. I targeted Checkbox A and set its value to Checkbox 1 (as you can see on the screenshot).

The problem is that when I click on my button, Checkbox A gets checked even though I did not check Checkbox 1. Also, when I check Checkbox 1, Checkbox A gets checked (which is fine), but if I want to uncheck Checkbox 1 and click my button again, Checkbox A stays checked (when it should reflect the state of Checkbox 1, whether it is checked or unchecked).

Can someone help me achieve the desired behaviour for my button? :blush: Thanks in advance!

I suspect it’s pulling a value from a different row. What do you have for the row setting in the Set Column action? Are the checkboxes and button on a detail screen or in a form? Are both checkboxes located in the same row in the table?

Hi Jeff, thanks for the quick reply!

  1. In my Set column action, I set the value of checkbox 1 to checkbox A.
  2. The checkboxes and button are on a detail screen, when I want to add a new project.
  3. Yes, the checkboxes are in the same row in the table.

Look at the screenshots so the whole thing is clearer!

N.B.: My example is about Checkbox 1 and Checkbox A, but I would like the behaviour to be extended to Checkbox 2 & Checkbox B, Checkbox 3 and Checkbox C, an so on.




Something still isn’t clear. In your first screenshot, I see that you are inside a form, which is not a detail screen. So are you trying to do this action while inside a form? Are both sections in that same form?

If you can include the entire window when taking screenshots, that can help a lot. Otherwise I lose a lot of context. There are a lot of little details elsewhere on the screen that can provide additional clues to your setup.

Oh, my bad! Yes, I am in a form and both sections are in the same form. Here are a few screenshots so you can see the whole form (since i can’t fit everything in one screenshot).

Sections 1 and 6 don’t really matter since they are working as expected, but I wanted to show you the whole thing. Thanks!





Yeah that becomes a problem. When you are inside a form, nothing has been written to the table yet. Your action can only pull values from an existing row, so it’s most likely using whatever values happen to be set in the first row of the table, and not from the new row you adding.

Honestly, I think you would be better off creating a custom form, which is essentially a single row table with several user specific columns and a detail screen that acts like a form. The difference is that each value you change is immediately written to the table. That way when you set up your action, it can copy the existing values written to the table and write them to the other columns. At the end of the form you have another button with an Add Row action to write the values to your final table. It’s a bit more setup but provides more flexibility.

1 Like

Ok, i see, it makes a lot of sense! Thank you so much for your help! :grin:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.