Improved submit functionality and form validation (javascript)

Created form submission and javascript validation logic.