Hello,
Here is another way to do on Save,
If we write OnSaveRequest in code we can avoid saving the form if user click on Cancel using below code,
[InfoPathEventHandler(EventType = InfoPathEventType.OnSaveRequest)]
public void OnSaveRequest(SaveEvent e)
{
e.IsCancelled = e.PerformSaveOperation();
if(e.IsCancelled)
{
e.ReturnStatus = true;
}
}