after form validation i want to run a javascript function

after form validation i want to run a javascript function

if the form valiation is showing error then it should not run the javascript funtion. if it is not showing the error then it should it should call that javascript function.