error check for form and ajax callback