I have a fairly complex infopath 2010 browser form (Being used to process expense claims) that is using code to perform the submission rather than a rule. The initial submit uses code as it needs to do so using elevated privs, and further submissions need to submit back to the original library (one per user).The form is also set to close upon submission.
All works fine, unless any of the validation fails. In that case the user gets a validation error, as expected, but when they click to confirm, the form closes and they lose their work.
Can't find any easy way around this (Which seems like a common scenario to me)
Is there any way to call some sort of global validation event? In which case I could call for the fields to be validated before trying the submit, and abort if necessary.
If not, I guess I'll have to write all of the validation in code too? Couple of queries on the best way to go about that.
Is there a specific validation event for each control I could/should be using?
Or should I just write a generic 'Validate Rules' procedure that looks at each field in turn?
How can I display these validation messages back to the user in a browser form? Can I hook into the standard error dialog? Or will I have to just write back to some hidden form fields?