I've tried to extend the XForm by adding a custom File upload component, but the problem becomes when I upload the file during my onSubmit event, if the XForm throws an error then the file is already uploaded.
I would like to change this so that I can detect if the Xform throws validation errors, then don't upload the file. But if the form is successful, then upload the file.
I've read this page: http://world.episerver.com/Documentation/Items/Tech-Notes/EPiServer-CMS-5/EPiServer-CMS-5-R2-SP2/Developing-with-XForms/
But I'm not familiar with Page.Validators collection, and I'm not sure what a StaticValidator is or how to use it. I have tried to detect if CancelSubmit is true during BeforeReadingPostedData but that didn't seem to do anything.
Am I missing something? Any help please?
I've figured out one way to do this. I hope it helps someone else.
I checked the form on Postback to see if the page is valid. Then if it was not valid then I did something.
protected void Page_Load(object sender, EventArgs e)
// do something for first time loading the page
// do something if when submitting the form, the form values are not valid