I need to show a check box in UI on click of Submit button, if there is a validation triggered on Submit.
The check box should not be visible otherwise.
If there is no validation getting triggered in UI then the form should just submit.
How can we achieve this.
Thanks in advance.
Discussion posts and replies are publicly visible
so the submit button doesn't submit? What's the flow you're going for?
If there is no validation error in the form then the form should get submitted.
If there is a validation getting triggered on the form on click of submit then I need to show a checkbox in the same form.
You could do something using a local variable as a counter. Have an a!save in your submit that increments the local variable up one. And on the checkbox have the showWhen be when the local variable is greater than zero
That's tricky. The saveInto in a button will only trigger if all validations are OK.
My suggestion would be to have a two-step submit. First show a button "Validate" and then the submit button.
Why not fire the validation whilst the form is being filled in (i.e. not defer until the 'Submit' button is selected)? That way the checkbox visibility can be fired by the same rule that is sued to conduct the visibility. And, in fact, the 'Submit' button's disabled status could also be controlled by the same rule, so it becomes very clear that you can't Submit until you've addressed the condition that the validation rule is setting.
When you say "if there is a validation triggered on Submit", I assume you want to display a validation message only when a user submits the form, and if validation fails, you want to display a checkbox too. If this is the case, you can create an expression rule to validate the form's data and simply return true/false. Use the same expression rule to control the visibility of the checkbox. For the validation message, utilize a!validationMessage() component. Here's the link to get more details: https://docs.appian.com/...Validation_Message.html
If your case is different and you have respective validations on your fields that get triggered immediately upon the user's input without clicking on the submit button, you can use these validation expressions to control the visibility of the checkbox.
Yes we can do it when the form is being filled.
But as per requirement, it has to happen in Submit.
I believe there's no way to do this exactly as you've stated - you would need to either use Stefan's approach of a 2-click process to first run a pre-validation then either submit or show the checkbox and submit, OR use Stewart's approach of running live validation in the background as the form is filled and showing the checkbox BEFORE the user attempts to submit, when applicable. Honestly this (latter) solution is far more user friendly, as you're not surprising them with some "gotcha" extra requirement when they thought they were ready to submit.
Also: remember that requirements don't and can't dictate design. They're two separate things. Many product owners have no concept of this of course, but that doesn't change the reality of it.
© 2022 Appian. All rights reserved.