I have some server side validations I want to perform. If they fail I'm currently throwing an error and redirecting to the not authorized page via: throw new RedirectException('../not-authorized.htm'); however the form still submits. How can I prevent the form from submitting?
This is on Transact Manager 18.104.22.168.
P.S. the redirection is working but for some reason it performs a second redirect to the portal landing. Don't know why that is either.
Another approach may be to make use of the Submission Data Validator service extension. The purpose of this service is to verify the integrity of the data at the time of submission. On a validation failure, this service essentially makes the submission record unavailable for delivery.
However, if your intent is to prevent submission altogether, you could roll-your-own validation via a dynamic data service that's invoked just prior to submission as Ben has already suggested.
You can find more information in the Trasact Services Guide in your Transaction Manager instance.
Hey Brad, great question. The submission preprocessor does not currently support this model. The way this is typically done is to call a Dynamic Data service to perform the validation when the Submit button is clicked and then automatically trigger the submit function programatically if the validation passes.
Note, the R&D team have had discussions around adding native support for this capability as it is a common requirement. Expect this in the 5.1 release.