Adding Custom Error Handling to BizFormItemEvents

Matt Bridges asked on July 28, 2016 23:28

I have a form (Bizform / On-Line Form) that I am going to execute code during the BizForm_Insert_Before event. I would like to return a custom error, from this event, and have it displayed on the page for the user to see. I would also like to cancel the insert, so a record is not created.

Correct Answer

Development Support answered on July 29, 2016 04:31

For the BizForm_Insert_Before, are you talking about the global event BizFormItemEvents.Insert.Before?

While you may be able to throw an exception and possibly catch it, i think you'll be better off cloning the Form web part and adding your logic in there.

If you are using the BizForm control's insert before event in the ascx.cs file, then i don't see why you will have trouble performing this. I would just (in a cloned copy of the Form web part) add a <asp:literal> tag and if the form submit is invalid, populate the literal with your message and then abort the insert, should be doable. May want to just add the logic to the Validate instead though, i think you can overwrite that...been a while.

1 votesVote for this answer Unmark Correct answer

   Please, sign in to be able to submit a new answer.