I can't seem to do an if statement check on the value returned from a
selected radio button (isexistingleag ue[1]). The code never runs anything
within the if statement that tests if "true" is returned, even though an
alert shortly before the if statement shows that the value returned *is*
true. See in-line comments for more details.
Any ideas what the problem is?
function submit_reg_user ()
{
var FailedCheck;
var newuserleague;
FailedCheck = false;
if (document.Regis terUser.email.v alue == "")
{
FailedCheck = true;
}
if (document.Regis terUser.usernam e.value == "")
{
FailedCheck = true;
}
if (document.Regis terUser.newpass word1.value == "")
{
FailedCheck = true;
}
if (document.Regis terUser.newpass word2.value == "")
{
FailedCheck = true;
}
// I use this alert to display the value in the radio button
// It displays "true" when checked, which is what i want
alert('++++' + document.Regist erUser.isexisti ngleague[1].checked + '++++')
//the code doesn't seem to pass this check
if (document.Regis terUser.isexist ingleague[1].checked == "true")
{
// it never displays this alert, even when the above alert
// displays "true"
alert("Its made it here");
if (document.Regis terUser.newleag ue.value == "")
{
alert("Its now made it here");
FailedCheck = true;
}
}
if (FailedCheck == true)
{
alert("You have not completed one of the fields correctly.");
}
else
{
alert('You cannot currently register. Please try again later.');
//document.Regist erUser.submit() ;
}
}
selected radio button (isexistingleag ue[1]). The code never runs anything
within the if statement that tests if "true" is returned, even though an
alert shortly before the if statement shows that the value returned *is*
true. See in-line comments for more details.
Any ideas what the problem is?
function submit_reg_user ()
{
var FailedCheck;
var newuserleague;
FailedCheck = false;
if (document.Regis terUser.email.v alue == "")
{
FailedCheck = true;
}
if (document.Regis terUser.usernam e.value == "")
{
FailedCheck = true;
}
if (document.Regis terUser.newpass word1.value == "")
{
FailedCheck = true;
}
if (document.Regis terUser.newpass word2.value == "")
{
FailedCheck = true;
}
// I use this alert to display the value in the radio button
// It displays "true" when checked, which is what i want
alert('++++' + document.Regist erUser.isexisti ngleague[1].checked + '++++')
//the code doesn't seem to pass this check
if (document.Regis terUser.isexist ingleague[1].checked == "true")
{
// it never displays this alert, even when the above alert
// displays "true"
alert("Its made it here");
if (document.Regis terUser.newleag ue.value == "")
{
alert("Its now made it here");
FailedCheck = true;
}
}
if (FailedCheck == true)
{
alert("You have not completed one of the fields correctly.");
}
else
{
alert('You cannot currently register. Please try again later.');
//document.Regist erUser.submit() ;
}
}
Comment