I got it working, I got the count of the errors in the form with this.Errors.Count. So I just have an if that checks if there are errors or not execute the rest of the code. For the rules im adding conditions to them or coding them instead of having them as button rules.