Can we check if there are any error messages on a Visualforce Page
?
My scenario is to redirect to a record after a record is inserted on button click.
I have an oncomplete
attribute on a commanbutton
that redirects to specific record.
But if there are any error message in process of insertion, it shouldn't redirect and error message should be displayed on page.
My plan was to check for any error messages on Visualforce Page
and call the redirect in oncomplete
if error messages doesn't exist.
<apex:commandButton id="btnSubmit" value="Submit" action="{!submit}" oncomplete="redirect()"/>
Please let me know if this is possible or any other solutions that suits my situation.