Possible to within an edit screen to have text change based on a switch component

I have a bunch of records that can either be set to “Active” or “Inactive” which will determine if users can select them from a list somewhere else in my app.

User can switch a record from Active to Inactive via the standard ‘Allow Users to edit’ switch for each record.

When they’re in edit mode the user can then turn a switch component between On/Off - setting the record to either active or inactive.

In the description component description I’ve simply put some text saying “Inactive/Active” thinking this should be enough for the user to understand that if the switch is switched to the left and is greyed out means “Inactive” and if it’s dark grey and turned to the right means “Active”

However it still seems to create quite some confusion for the user to figure out if a record is switched to either active or inactive.

I was hoping to be able to emphasis it’s status by having the text label change according to the switch status. However I can only get the text to change after a user have saved the record edits, but I was hoping to do something a bit more immediate - for the text to change as soon as the switch is switched.

Does someone know if this is possible?

Not possible in an Edit screen. You would need to do it on a details screen. Either allow the user to change the value directly, or write to a user specific column first and then use a set column values with an action (eg. Custom Form)

1 Like

Couldn’t you just have a couple of text components on the screen? One that says Active and one that says Inactive… and then conditionally show each one based in the switch value.

3 Likes

Nice!

I wouldn’t have expected that to work (unless you could access Screen Values) - but it does.

2 Likes

Yeah it’s tricky to understand when to use Screen values and when to use Normal values. Always something I have to experiment with to see what it can or cannot do.

I think screen values make sense for choice components…where you’re trying to filter the choice table based on values from the screen table. Whereas visibility conditions always use the table of the edit screen. So, I think Screen values make sense when you need to compare values across different tables, but if you are comparing values in the same table, then you can just use the Normal values

The only thing that’s not accessible or dynamically updated, as you pointed out, is computed columns.

3 Likes

The interesting thing is if I watch the data view whilst toggling that switch, I see nothing changing. Which is what I would expect, but also why I wouldn’t have expected it to work. It’s almost like the column values are behaving like screen values in this case? :thinking:

3 Likes

What a great work around.

I was thinking in same lines as @Darren_Murphy that I would need screen values for anything like this to work. I was secretly hoping “a little dirty hack” would exist before changing too many things around.

Thank you so much - now I don’t think I can spell it out any more for the user

3 Likes

Yeah just one of those trial and error things. I prefer to understand how things work, but if I can’t, I will accept that they just work. :grin:

1 Like

hahaha - if it works it works…
There is nothing wrong with a bit of magic every now and then :man_mage:

1 Like

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