Create dynamic error message on different text fields

Hello,

I’m trying to build something quite simple to in javascript but I can’t find a way to do it in the wappler way.

I have this simple sign up form:


(it’s french but you got it: simple email and password)

My SC action checks if the email already exists, if it does it returns an error. It also checks if the password is well formatted (I know I could do that front end), if it’s not it returns an error.

So when a receive the error, I want to display it on the correct help text (email/password field) with the error message.

In code it would be something like:
if error.message == wrong email
then emailHelp.innerText = “Wrong email try again”
else if error.message == wrong password
then passwordHelpText.innerText = “Wrong password try again”

I was going to create a flow that is trigger by the dynamic event on the form with the Error Trigger but I can’t set a text value for the help texts, only for the input fields.

What is the correct way ? Use the “run javascript” action on the flow ?

Thanks

This documentation should help.

Okay thanks that seems to work !

But let’s say have a data coming from a SC action.
This data has a two values field and text. (ex: {textFieldId: “textField1”, value: “new text value”})

In my page I have 3 text fields, I want to change the text value of the one with the same id than the SC’s textFieldId.

How could I achieve that ?