Add client-side error handling code for invalid required if statement