javascript validation: Did they select a button? any button?

I have 3 radio buttons. I need to have the user select either a trial of the product or one of two subscription options.

I don't care which button. I don't need the value of the button. I just need to make sure they selected something and, if they didn't, display an message box.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Just set the first one to selected (or whichever one you want selected by default) then you don't have to worry about one being selected.
So just add selected into your first radio button
LyndaPostalAuthor Commented:
I understand that ... I would LOVE to do that, but the client (bless their black little heart) wants NOTHING to be assumed. So no pre-selection. But they (of course) want it caught. A polite little message asking the user to please make a selection.

I've been working in I've not worked in classic asp in a while. And .net validation is drag-n-drop, set some parameters and go (for the most part). I've got two more sites to make changes to by Monday and my head hurts. There has got to be a way to do this.

Please ....
Add to your FORM tag
onsubmit="return checkradio()"

Add this js function
function checkradio(){
	var radiocheck = false;
	for (var i=0; i < document.form1.selectOption.length; i++){
		if (document.form1.selectOption[i].checked){
			radiocheck = true;
	if (radiocheck ==false){alert("Select an option");return false;}

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
LyndaPostalAuthor Commented:
Thank you so much. I knew it would be simple for someone who knows javaScript. I did Google searches, searched within the ee javascript solutions and could find nothing that simply did a quick radio button validation.

I'm grateful.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.