I'm trying to verify a form with two different types of data-- a text field and a group of radio buttons. Here's the HTML for the form, cleand up to remove some table formatting and other fluff that I don't believe is causing issues:
<form name="myForm" action="mailto:firstname.lastname@example.org" method="POST" enctype="text/plain" onsubmit="return validateForm()">
<p><input type="text" name="opName" length="40"></p>
<p><input type="radio" name="product" checked="yes" value="0" style="display: none;">
<input type="radio" name="product" value="bert"> Bert
<input type="radio" name="product" value="ernie"> Ernie
<input type="radio" name="product" value="elmo"> Elmo</p>
<input type="submit" value="Submit">
All well and good. The form works fine for my purposes. What I'm having issues with is verification. I'm using a hidden, selected radio button with a value of "0" as a default selection for the "product" variable. Here's the code I'm trying to use to verify the form before it's submitted:
if (x==null || x=="")
alert("You must enter your opName.");
alert("You must select a product.");
While the opName will validate without any issues, the product will not. Can someone point me in the right direction of what I'm doing wrong here? I've tried everything I can think of, and haven't had any luck. Any help is greatly appreciated.
Thanks to y'all, you're always great!