2081 2

CSC329 ยท 2081 ยท 10 marks

Create an HTML file containing form with textbox, select and radio button. Now write a javascript function for validating the form elements. Validate textbox for required, select field should have some value selected and radio button should be checked.

Create an HTML file containing form with textbox, select and radio button. Now write a javascript function for validating the form elements. Validate textbox for required, select field should have some value selected and radio button should be checked.[10]

Web TechnologyChapter 4: Client Side Scripting with JavaScriptEvent Handling and Form Validation

--- - The <form tag uses the onsubmit event handler to call validateForm(). - Returning false from the function prevents form submission if validation fails. - Checks that the textbox is not empty (required field). - The default option has value="", so if nothing is selected, validation fails. - ...