updated javascript form validation