refactor js form validation/focus