Added javascript to handle form submission and user validation.