Below you see a simple contact form which has fields for email address and comments.
a) Write JavaScript code which checks the input fields when the form submit-button is clicked. Display the entered values with alert -dialogs. Use onsubmit-event on the form tag. Make sure that your code cancels the submission of the form if needed. Hint: See the PowerPoint -slides.
b) Enhance the code and write if-statements to check the following: the length of email address should be atleast 6 and less than 15. It should also have a @ - character. Check also that the comment field is not be empty and the content should be trimmed down to 50 characters. Utilize JavaScript String-methods.
c) Should an error occur, highlight the erroneous field and provide some feedback to the user. Preferably by displaying some text message on the page, next to the input field. See the lecture slides for demo.