Reset Input Value To Previous Value

I want to reset an input element back to it’s previous value when the value is changed and all or part of the new value doesn’t satisfy acceptance criteria.

For example, I don’t want the new value to contain the letter “B”. So if the original value entered was “test” and the new value is 'testB", I want to reset the value to “test” when the change occurs. I’ve got the criteria for checking for B but not for resetting the value.

you can store the initial value in a custom state and have a workflow like “when input’s valye is changed” and an only when condition where it doesn’t satisfy the thing

Thanks for the suggestion to use a custom state. After a lot of trial and error, I got this to work using an input element and two workflows. I’m providing the details with screenshots in case anyone else wants to do something similar.

In this example, I wanted to limit the input element to only special characters. So when one or more characters are entered and a click event occurs, the system checks to see if any non-special characters are entered using a regex expression.

If there aren’t any non-special characters entered, then a custom state is set equal to the inputted value.

And because the initial content attribute for the input element initial content is set to the custom state, the value of the input element is set to the inputted value (basically resetting the value to the entered value).

If there are non-special characters entered, then the input is reset initializing the input element.

And because the initial content attribute of the input element is set to the custom state, the value gets set to the previously set value of the custom state.

Next thing I want to do is figure out how to get an alert “error” message displayed in the process - between the “wrong” entry being entered and the previous entry being reset - and delay the process of resetting the previous entry until the user clicks out of the error message to stop it from being displayed.

This topic was automatically closed after 70 days. New replies are no longer allowed.