Field validation using formula

Hi…im having some n fields in a form. In each and every field there is an validation.

@if(@thisname=“”;@failure(--------);@success) — like this acc to requirement

there is a save button…

In that @commands filesave and fileclosewindow is there…

wen we click save… its checking the validation and window is closing immediately…

**** My requirement is if any validation gets failure, window should not close…(It have to save and close only wen it satisfies all validations)