conditionally submit the Interface form using a button in appian

Hi All,

I am facing one challenge to implement one behaviour in appian interface. My interface presents the read only data to the user and user will take action based on his findings by selecting a dropdown value. Finally user hits a "SUBMIT" button whose implemetation is as below. where we call an integration which will update the data and returns an error if an exception found. So my requirement is when user clicks "SUBMIT" button if error occured then form should not submit and close and error message should be displayed. If data updated successfully form should close. I tried below submit condition as well but it didnt work. suggest something.

a!buttonArrayLayout(
buttons: {
a!buttonWidget(
label: "Update",
saveInto: {
rule!PM06_PortalApprove(
tenantId: "77b50320-5f06-5740-84f4-18d4a8cda51d",
identifierId: "s57",
portalTransactionId: property(local!jsonData, "PortalTransactionId", null),
comments: "test",
onSuccess: {
/* Handle successful update */
a!save(local!ErrorMessage, null)
},
onError: {
/* Handle HTTP error */
a!save(local!ErrorMessage, fv!error.message)
}
)
},
submit: if(isnull(local!ErrorMessage),true(),false()),
style: "PRIMARY",
loadingIndicator: true,
validate: true
)
},
align: "END"
)

  Discussion posts and replies are publicly visible