Possible bug report or maybe I'm looking at this the wrong way.
I have a few text inputs that have the validation "Required" and a button that triggers a javascript query where I check the validation of those inputs. If the user interacts with each of the text inputs everything is fine, but if they skip this and click the submit button validation hasn't triggered yet and allows them to continue when it shouldn't (despite me manually triggering validation for these inputs in that query).
I made a small app to demonstrate. I dragged a textbox into the new project and set the required validation.
I then added the following javascript query. The first time it runs it says it is valid (I'm not sure if the "await" is appropriate here, but the behavior is the same with or without it) despite it not being valid, the second time it runs it does work properly though.
I also tried making a custom validation and had the same issues.
The workaround I've found so far is triggering textInput1.validate() and having all my validations hidden (so the user isn't greeted with a bunch of errors) on launch of the app, then have a javascript query un-hide the validation when a confirmation button is pressed.
I know having this property defaulted to true has been discussed before. It apparently has a performance impact and and so it should only be used when needed.
One suggestion would be to automatically enable it when the JS query uses variables that are then subject to this issue. Or possibly, display a notice that you may need to enable this property if the query is using variables. I use this parameter frequently and I still forget at times.
Yes, 100% agree! We have a feature request internally to add a warning that could conditionally show in the query editor depending on whether the code would be impacted by the setting. I'll add another +1 to that request & will follow up here when it ships
Hi there, I see there's a workaround for the JS query issue, but what about for the issue where the button should be disabled but because the validators don't initially run, the button is allowed to be clicked? Are there plans to fix that behavior? Please see the attached example app and screenshot.
These options work for button validation, but it's pretty obnoxious to have warning/error messages shown by default because we have to run the validate function.
Not the best solution, but I went with having the inputs not be validated on startup. This means the button can be clicked and is not disabled, but on the first click I await my validation test and only if it passes validation do I allow the action to be performed. If it does not pass then the validation text appears and the submit button is disabled until validation passes.