469,272 Members | 1,473 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,272 developers. It's quick & easy.

Javascript form problems!!!!

Hello

I have a problem with my javascript. I have made a small form on my website containing a few radiobuttons. When a user selects a radiobutton and hits the next button it should take him to a certain url. but NOTHING happens.........!

Here is my code, please help my figure out what's wrong. Thank you!

Expand|Select|Wrap|Line Numbers
  1.  
  2. <script language="javascript">
  3. function callpage(){
  4. var field = document.QuoteForm.dataset;
  5. var upload_task;
  6.        for (i = 0; i < field.length; i++) {
  7.  
  8.             if (field[i].checked == true) {
  9.                  //alert("value of "+field[i].name+" is "+field[i].value+" pwb num is "+pwb_field);
  10.               upload_task = field[i].value;
  11.             }
  12.  
  13.        }
  14.     if (upload_task == 1) {
  15.  
  16.          window.location.href = "./previousinvoices.php";
  17.         }
  18.         if (upload_task == 2) {
  19.                   window.location.href = "./previousdeliverynotes.php";
  20.         }
  21.         }
  22. </script>
  23.  
  24. <form method="post" action="" name="MyForm">
  25.  
  26. <input name="dataset" type="radio" id="quote1" value="1">
  27. <input name="dataset" type="radio" id="quote2" value="2">
  28.  
  29. <a href=# onClick=callpage(); return false;><IMG BORDER=0 NAME="send" src="../images/submit.jpg" style="border-style:none;"></a>
  30.  
  31.  
Apr 26 '07 #1
1 994
Logician
210 100+
Expand|Select|Wrap|Line Numbers
  1. var field = document.QuoteForm.dataset;
  2. .
  3. .
  4. .
  5. <form method="post" action="" name="MyForm">
  6.  
Does this make the obvious problem any clearer?

Use the JS console, that's why it's there.
Apr 26 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by minstrel80232 | last post: by
72 posts views Thread by Stephen Poley | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.