Javascript code for validating radio buttons

Hello, I have a form that has 2 attachments on it, the first was easy to configure that validation as it is mandatory for 1 attachment.The second attachment which is my default is only needed if user select Yes on a Radio Choice.By default the caption for that list is the first item.For example if you’re asking a user to select a country the first option is “Select a country” and the name of the countries follow so we need to check if the first option is selected and then display a message to select an option.There are two main methods for validating forms: (usually done using Java Script).

Watch the video below and then scroll down to see the sample code.

You can then adapt this form to your own requirements.

Let's build a simple form with a validation script.

When you submit a form to a CGI program that resides on the server, it is usually programmed to do its own check for errors.

If it finds any it sends the page back to the reader who then has to re-enter some data, before submitting again.