updated javascript for form