How to hide / show element on condition that custom state changed?

Hi all,

I am quite new to Bubble and just getting hang of custom states.
I researched this issue and couldn’t find solution.

I have popup for user to add documents with various inputs including repeating group with list of positions it applies to.

Repeating group is set with check boxes (icons) and custom state that set list of position.

All is working fine up to this point, but now I have issue when the popup is in edit (custom state).
I want for the “save” button to be hidden and only appear when the value of any input changes.
I have managed to create a condition on “save” button to do a search with constraints of inputs so, that it is only visible when new values are entered.

I cannot figure out how to set condition on button element so that it is hidden when values of repeating group are the same in addition to other inputs.

Any help would be much appreciated!

Thanks in advance!

Hi there, @rockovo… I could be off base here (and maybe I don’t understand your post), but could you simplify things by having a custom state (yes/no) called something like changes made, and when any input is changed on the popup, set the custom state to yes and show the save button when the custom state’s value is yes?

Best…
Mike

Thank you @mikeloc for reply!

It does seem like using custom state would be simpler and I tried to work out how to implement your suggestion, but I encountered couple issues.

The main problem I have, is with repeating group.

When NEW document is added, user is selecting random positions from repeating group to define which positions it applies to. I didn’t use here standard check box, but an icon instead, and saved it to custom state called “select_position”.

Later, when user clicks EDIT button, I use “Display data in popup”, where I set state “edit_mode” along with “select_position” referring to record in database so that selected positions are checked.

Now for the user to edit checked positions.
My understanding is that (when in “edit_mode”), if user add/remove positions (not all positions must change), then I should create new custom state (let’s call it “edited_positions”). Later, create event “Do when condition is true”, only if initial state “select_position” value is not “edited_positions” value. Then if mentioned condition is true, I set “changes_made” state to yes and show / hide save button…

What I can’t work out, is how to detect a change to custom state. How to create new custom state (“changed_positions”) so that value of it is the same as “select_position” including those positions added or removed by user in edit (some positions could remain).

I like the idea of using custom states and I want to figure this out, cause I really think this will be helpful at later stages.

Sorry if my description is messy. If you’d like me to clarify something, please don’t hesitate to ask!

Many thanks again!

I haven’t worked through an example, but it seems to me that it could be simpler than you are trying to make it. I don’t think I would be comparing custom states to other custom states or doing whatever it is you described. Rather, I might use An input’s value is changed workflow events to set the yes/no custom state to yes when any input is changed and the new value of the input is not the same as the value in the input’s associated field in the database. So, again, you’re not trying to detect changes to other custom states… you are simply setting a yes/no custom state to yes when an input’s value is changed.

I used “An input’s value is changed” and subsequently workflows as you described for all the inputs and it works as you suggested. I just can’t seem to find a way to apply this to repeating group or “select_position” state since it’s not an input element and doesn’t show as an element in Workflows tab. Unless I’m missing something…

Thanks!

Edit:
I tried to set workflow on element click (don’t remember now how it’s called cause I’m on my mobile atm - similarly to above), when check box is clicked. That’s when I run into issue of referring to values of a custom state.

It’s hard to do this through walls of text, so maybe you can share some screenshots or a read-only link to your editor. That being said, it sounds like you have an icon in a repeating group, and when the icon is clicked, you run a workflow. Can’t you add a step to that workflow that changes the “generic” custom state we have been talking about to yes?