kittyblueboots
09-23-2003, 09:04 PM
I have a form with radio buttons which lists different ways for a person to be contacted. Once a radio button is clicked, it checks to see whether the information exists. If it doesn't it returns a message requesting the information. Now this is all fine.
My problem: How can I force the radio button to be 'un-selected' if there is no information for that contact?
Heres the section of code affected:
function CheckContact(contact) //contact is the name of the
//radio buttons
{
for (var index = 0; index < contact.length; index++)
{
if (contact[index].checked)
{
var answer = contact[index];
break;
}
}
if (answer.value == "email") //only testing the email
{ //for now
email = document.getElementById("email");
if (email.value == "") //if empty
{
alert ("You have not entered an email address for us\n" +
"to contact you by.");
email.focus();
//something belongs here to uncheck my radio
//button
return false;
}
}
if (answer == "postal")
{
alert ("postal");
}
if (answer == "phone")
{
alert ("phone");
}
}
I would really appreciate the help.
JavaJavaJavaJavaJavaJavaJavaJavaJavaJavaJavaJavaJavaJava
luv, Kitty
My problem: How can I force the radio button to be 'un-selected' if there is no information for that contact?
Heres the section of code affected:
function CheckContact(contact) //contact is the name of the
//radio buttons
{
for (var index = 0; index < contact.length; index++)
{
if (contact[index].checked)
{
var answer = contact[index];
break;
}
}
if (answer.value == "email") //only testing the email
{ //for now
email = document.getElementById("email");
if (email.value == "") //if empty
{
alert ("You have not entered an email address for us\n" +
"to contact you by.");
email.focus();
//something belongs here to uncheck my radio
//button
return false;
}
}
if (answer == "postal")
{
alert ("postal");
}
if (answer == "phone")
{
alert ("phone");
}
}
I would really appreciate the help.
JavaJavaJavaJavaJavaJavaJavaJavaJavaJavaJavaJavaJavaJava
luv, Kitty