I have a form with a series of radio buttons and checkboxes, but when I submit the form blank, Javascript says they have a value!
So if someone could help me figure out why that even though the radio buttons are blank, they seem to have a default value?
If you really want, I can post the code, but be very warned, the code is huge.
But, in short, this is what I have.
<script type="text/javascript" language="javascript">
if (document.layers) {
browserType = "nn4"
} else if (document.all) {
browserType = "ie"
} else {
browserType= "gecko"
}
function safeGetElement(id) {
if (browserType == "gecko" )
return eval("document.getElementById('" + id + "')");
else if (browserType == "ie")
return eval("document.getElementById('" + id + "')");
else
return eval("document.layers['" + id + "']");
}
function FormCheck () {
var question = 2;
var quid = "q" + question;
while (question<=13) {
var quid = "q" + question;
var QVal = safeGetElement(quid).value;
var tracker = tracker + "\n" + quid + " " + QVal;
question++;
}
alert('Check the form! ' + tracker);
}
</script>
</head>
<body>
Question 1: Who are you?<br>
<input name="who" type="radio" value="1" id="q2" /> I am Me
<input name="who" type="radio" value="2" id="q2" /> I am You
Just repeat that one question about 13 times over and basically, this is what it outputs in the alert...
"Check the form!
q2 1
q3 1
etc..."
(Those intergers next to q2 are the values)
Now, it also appears that no matter how I change it, these values remain constant.

New Topic/Question
Reply


MultiQuote




|