Forum Documentation Showcase Pricing Learn more

Set element's custom state on condition?


#1

Can this be done? It appears not.

It seems perfectly reasonable that one might want to alter the custom state of an element based on a condition; yet the choices are restricted to the mostly visible properties/attributes of an element - e.g. font size, color, visibility, etc.

The ability to set a custom state would be truly useful. Am I overlooking something?


Allow access to custom states from element conditions
#2

Yeah unfortunately the set state operator at the moment is only available through workflows.

But yes, I agree it would be nice to have the inclusions of setting a state on an element with the elements conditional properties. Such as ‘When this group is hovered…’ set state to x or ‘When this input is focused’…
set state to x.

There is a hack workaround for setting a state on a element in relation to a condition, but it is limited. For instance you could have the element invisible then set a condition to make it visible, then you can use the workflow ‘When condition is true’ > ‘When x element visible’ set state to x. This is only handy if a few scenarios though such as dropdown menus.

Anyway, might be worth checking if the idea is posted for this, I’m sure its been mentioned in the past, but might be worth bringing back to life if the post is dated as its a fair request.


#3

Thanks for the reply, @luke2. That’s exactly what I wound up doing - i.e. using the visibility property.

In my case, though, I wanted to change properties on multiple elements in response to the same “condition”. Turns out the condition is a rather lengthy dynamic expression involving a database look-up, and I wanted to adhere to the DRY (don’t repeat yourself) principle instead of entering same lengthy expression over and over again. It would also simplify maintenance since there would be one place to update the expression if need be.

So I thought a single custom state containing the result of the expression could be referenced in each element’s condition, but no go. Using the invisibility property of one of the elements worked in this situation, but it’s not as “semantically clean”. Anyway, I’ll post it as a suggestion.