Added javascript for form validation and submission