Any way to access state's element?

I use regex in my states to set errors if the fields are not filled/filled with wrong data. I have a form that is long and overflows. What I’d like to do, is check for validity and if invalid do something like this.scrollIntoView() with the this being the target of the state. Is this even possible? How do states work? Is it just a dynamic class?

I dont think it’s possible from nocode/lowcode. You can from coded components.

But maybe we could expose it the same way we expose elements position, by adding a watch state on settings and expose elements states globally. Opinion @aurelie ?

For now you will probably have to do it differently. You can apply a native class on your fields and scroll to the first element found with the error class for exemple.

Capture d’écran 2023-11-30 à 17.40.58

I actually kept the HTML validation, and on invalid, I trigger this.scrollIntoView(); So that works for now :slight_smile:

1 Like

States are an internal data that we do not expose at the moment.
At the moment, the best way to do it will be to have an id/class on the element, and use js to scrollInto.

When we will rework the components actions, maybe we can add a way to get the HTML element instance, or just add a “ScrollIntoView” actions

1 Like

Actually, it would be enough to be able to have the HTML element reference. But thanks for the reply :slight_smile: