M
Mokoena
I can't seem to do an if statement check on the value returned from a
selected radio button (isexistingleague[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.RegisterUser.email.value == "")
{
FailedCheck = true;
}
if (document.RegisterUser.username.value == "")
{
FailedCheck = true;
}
if (document.RegisterUser.newpassword1.value == "")
{
FailedCheck = true;
}
if (document.RegisterUser.newpassword2.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.RegisterUser.isexistingleague[1].checked + '++++')
//the code doesn't seem to pass this check
if (document.RegisterUser.isexistingleague[1].checked == "true")
{
// it never displays this alert, even when the above alert
// displays "true"
alert("Its made it here");
if (document.RegisterUser.newleague.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.RegisterUser.submit();
}
}
selected radio button (isexistingleague[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.RegisterUser.email.value == "")
{
FailedCheck = true;
}
if (document.RegisterUser.username.value == "")
{
FailedCheck = true;
}
if (document.RegisterUser.newpassword1.value == "")
{
FailedCheck = true;
}
if (document.RegisterUser.newpassword2.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.RegisterUser.isexistingleague[1].checked + '++++')
//the code doesn't seem to pass this check
if (document.RegisterUser.isexistingleague[1].checked == "true")
{
// it never displays this alert, even when the above alert
// displays "true"
alert("Its made it here");
if (document.RegisterUser.newleague.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.RegisterUser.submit();
}
}