It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

Radio Buttons selected - JS Alert "true" ?!?!

Radio Buttons selected - JS Alert "true" ?!?!

Postby tech_angel420 on Tue Feb 01, 2005 3:21 pm

Okay I've got this page and it happens to have two sets of radio buttons. On test, I select one of the first set and I get a Javascript alert that tells me "true". I don't know where it came from or how to get rid of it. I don't want it to do that, of course... In any case, I've removed a bunch of the JS (validation script) and I get the alert regardless. Can someone take a look at this and show me what the heck is going on?? lol... Any help here SUPER appreciated..

Code: Select all

<html>
<head>
<style type="text/css">
#Div1, #Div2, #Div3
{
DISPLAY: none;
}

</style>
<title>Monthly Payment Options</title>

<link href="cssALL.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/javascript">

//toggle feedback
function Toggle(theDiv) {
   document.getElementById("Div1").style.display = "none";
   document.getElementById("Div2").style.display = "none";
   document.getElementById("Div3").style.display = "none";
   document.getElementById(theDiv).style.display = "block";
   }
   
   
   //toggle feedback
function toggle2( targetOpen, targetClose ){
   if (document.getElementById){
      targetO = document.getElementById( targetOpen );
      targetC = document.getElementById( targetClose );
         if (targetO.style.display == "none"){
            targetO.style.display = "";
            targetC.style.display = "none";
         }
//         else {targetO.style.display = "none";}
   }

}

</script>

</head>
<body id="MakeAPayment">
print ("<div class=\"row3\"><p class=\"pmtheads2\">Please choose one:</span>&nbsp;
<label for=\"Check\">Check</label><span lass=\"formw3\">
<input name=\"ToggleDivs\" type=\"radio\" value=\"Check\" onClick=\"Toggle('Div1');alert(document.formInsertRecord.ToggleDivs[ 0 ].checked)\" id=\"Div11\"></span>&nbsp;

<label for=\"Credit\">Credit</label><span class=\"formw3\">
<input  name=\"ToggleDivs\" type=\"radio\" value=\"Credit\" onClick=\"Toggle('Div2');alert(document.formInsertRecord.ToggleDivs[ 1 ].checked)\" id=\"Div22\" ></span>&nbsp;

<label for=\"EasyPay\">EasyPay</label><span class=\"formw3\">
<input  name=\"ToggleDivs\" type=\"radio\" value=\"EasyPay\" onClick=\"Toggle('Div3');alert(document.formInsertRecord.ToggleDivs[ 2 ].checked)\" id=\"Div33\"></span></div><br>\n");

print ("<div id=\"Div1\" style=\"display:none;\"><br>\n");
print ("<div class=\"row\"><span class=\"label\"><span class=\"asterisk\">*</span>Credit Card Type:</span><span class =\"formw3\"><select name=\"selectCCType\">&nbsp;");
      foreach ($CCList_array as $ctype2)
      {
      print("<option>" . $ctype2 . "</option>");
      }
      print ("</select></span></div>\n");

print ("<div class=\"row\"><span class=\"label\"><span class=\"asterisk\">*</span>Name on Card:</span><span class=\"formw2\"><input name=\"textCCName\" /></span></div>\n");
print ("<div class=\"row\"><span class=\"label\"><span class=\"asterisk\">*</span>Credit Card Number:</span><span class=\"formw2\"><input name=\"textCCNumber\" /></span></div>\n");
      
print ("<div class=\"row\"><span class=\"label\"><span class=\"asterisk\">*</span>Expiration Month and Year:</span><span class =\"formw3\"><select name=\"selectCCExpMonth\">");
      foreach ($ExpMonth_array as $ctype3)
      {
      print("<option>" . $ctype3 . "</option>");
      }
      print ("</select></span>\&nbsp;");
         
      print ("<span class =\"formw3\"><select name=\"selectCCExpYear\">");
      foreach ($ExpYear_array as $ctype4)
      {
      print ("<option>" . $ctype4 . "</option>");
      }
      print ("</select></span></div></div>\n");
       
//Payment Types - Check//
print ("<div id=\"Div2\" style=\"display:none;\"><br>\n");         
print ("<div class=\"row\"><span class=\"label\"><span class=\"asterisk\">*</span>Name on Check:</span><span class=\"formw2\"><input name=\"textCHName\" /></span></div>\n");
      
print ("<div class=\"row\"><span class=\"label\"><span class=\"asterisk\">*</span>Check Number:</span><span class=\"formw2\"><input name=\"textCHNumber\" /></span></div>\n");
      
print ("<div class=\"row\"><span class=\"label\"><span class=\"asterisk\">*</span>Account Number:</span><span class=\"formw2\"><input name=\"textCHAccountNum\" /></span></div>\n");
      
print ("<div class=\"row\"><span class=\"label\"><span class=\"asterisk\">*</span>Routing Number:</span><span class=\"formw2\"><input name=\"textCHRouting\" /></span></div>\n");
      
print ("<div class=\"row\"><span class=\"label\"><span class=\"asterisk\">*</span>Bank Name:</span><span class=\"formw2\"><input name=\"textCHBank\" /></span></div>\n");
      
print ("<div class=\"row\"><span class=\"label\"><span class=\"asterisk\">*</span>Payment Date:</span><span class=\"formw2\"><input name=\"textCHDate\" /></span></div></div><br>\n");
      
//Payment Types - EasyPay System//
print ("<div id=\"Div3\" style=\"display:none;\">\n");
print ("<div class=\"row99\"><div class=\"row34\"><p class=\"pmtheads3\ align=\"center\">No Postage. No worries. You tell us the day and <br>  the amount, we take care of the rest.  Take it easy <br>and get set up on our continuous payment plan.</p></div></div><br>\n");
      
print ("<div class=\"row3\"><p class=\"pmtheads2\"><span class=\"asterisk\">*</span>Please choose one: </span>&nbsp;<label for=\"label5\">EasyPay by Check</label><span class=\"formw3\">
<input name=\"PaymentType2\" type=\"radio\" value=\"CheckEP\" onClick=\"toggle2('checkInfoEP', 'creditInfoEP')\"id=\"checkEP\"></span>&nbsp;

<label for=\"label6\">EasyPay by Credit</label><span class=\"formw3\"><input  name=\"PaymentType2\" type=\"radio\" value=\"CreditEP\" onClick=\"toggle2('creditInfoEP', 'checkInfoEP')\" id=\"creditEP\" ></span>&nbsp;</div><br>\n");
      
//PT - EasyPay - Credit//
print ("<div id=\"creditInfoEP\" style=\"display:none;\"><br>\n");
print ("<div class=\"row\"><span class=\"label\"><span class=\"asterisk\">*</span>Credit Card Type:</span><span class =\"formw3\"><select name=\"selectCCType\">&nbsp;");
      foreach ($CCList_array as $ctype2)
      {
      print("<option>" . $ctype2 . "</option>");
      }
      print ("</select></span></div>\n");
print ("<div class=\"row\"><span class=\"label\"><span class=\"asterisk\">*</span>Name on Card:</span><span class=\"formw2\"><input name=\"textCCName\" /></span></div>\n");

print ("<div class=\"row\"><span class=\"label\"><span class=\"asterisk\">*</span>Credit Card Number:</span><span class=\"formw2\"><input name=\"textCCNumber\" /></span></div>\n");

print ("<div class=\"row\"><span class=\"label\"><span class=\"asterisk\">*</span>Expiration Month and Year:</span><span class =\"formw3\"><select name=\"selectCCExpMonth\">");
      foreach ($ExpMonth_array as $ctype3)
      {
      print("<option>" . $ctype3 . "</option>");
      }
      print ("</select></span>\&nbsp;");
         
      print ("<span class =\"formw3\"><select name=\"selectCCExpYear\">");
      foreach ($ExpYear_array as $ctype4)
      {
      print("<option>" . $ctype4 . "</option>");
      }
      print ("</select></span></div>\n");
      
print ("<div class=\"row\"><span class=\"label\"><span class=\"asterisk\">*</span>Day of Month to be Drafted:</span><span class=\"formw2\"><input name=\"textRecurringDate\" /></span></div></div>\n");
      
//PT - EasyPay - Check//
print ("<div id=\"checkInfoEP\" style=\"display:none;\"><br>\n");   print ("<div class=\"row\">
<span class=\"label\"><span class=\"asterisk\">*</span>Check Number:</span><span class=\"formw2\"><input name=\"textCHNumber\" /></span></div>\n");

print ("<div class=\"row\"><span class=\"label\"><span class=\"asterisk\">*</span>Account Number:</span><span class=\"formw2\"><input name=\"textCHAccountNum\" /></span></div>\n");
      
print ("<div class=\"row\"><span class=\"label\"><span class=\"asterisk\">*</span>Routing Number:</span><span class=\"formw2\"><input name=\"textCHRouting\" /></span></div>\n");
      
print ("<div class=\"row\"><span class=\"label\"><span class=\"asterisk\">*</span>Bank Name:</span><span class=\"formw2\"><input name=\"textCHBank\" /></span></div>\n");
      
print ("<div class=\"row\"><span class=\"label\"><span class=\"asterisk\">*</span>Day of Month to be Drafted:</span><span class=\"formw2\"><input name=\"textRecurringDate\" /></span></div></div></div>\n");
      
print ("</div>\n");
print ("\n");   
print ("</form></div></div>\n");

?>

</div>
</body>
</html>

tech_angel420
 
Posts: 27
Joined: Thu Dec 16, 2004 4:02 pm

Postby webmaster on Tue Feb 01, 2005 3:41 pm

You need to name them, if you just one radio-button to be selectet at the same time, use the same name, for example:

Code: Select all
<input type="radio" name="1" value="1" checked><input type="radio" name="1" value="2">
Make sure to check out our TNX Review and Link Vault Review
User avatar
webmaster
Site Admin
 
Posts: 2695
Joined: Tue Aug 17, 2004 1:07 pm
Location: Sweden

Postby tech_angel420 on Tue Feb 01, 2005 3:55 pm

They're already named. What do you mean?

Code: Select all

<input  name=\"ToggleDivs\" type=\"radio\" value=\"Credit\"
<input  name=\"ToggleDivs\" type=\"radio\" value=\"Check\"
<input  name=\"ToggleDivs\" type=\"radio\" value=\"EasyPay\"



The problem is within the first set of radio buttons... I don't know what you're talking about.. Are you saying there's an issue with making it "input name="blah" type="radio"" ??
tech_angel420
 
Posts: 27
Joined: Thu Dec 16, 2004 4:02 pm

Postby tech_angel420 on Tue Feb 01, 2005 4:39 pm

Nevermind... I figured it out. DOH!
tech_angel420
 
Posts: 27
Joined: Thu Dec 16, 2004 4:02 pm


Who is online

Users browsing this forum: No registered users and 6 guests