troubleshooting Question

What is the cause of preventing the calculation to work in a form?

Avatar of jtmedeiros
jtmedeiros asked on
Web Languages and StandardsJavaScript
3 Comments1 Solution180 ViewsLast Modified:
I have a generic form where it includes 'Calculate Here' button and the calculation would do its thing and it all works just fine. I wanted to add another category consisting of two radio buttons ('Single' and 'Double') and depending which one user clicks on, the name will appear on the text field box besides it. Look at code below.

Now when I click 'Calculate Here', the calculation does not work. For some reason, the code for the radio buttons seems to have blocked the form from calculating the values. How do I know? When I take away the code for the radio buttons (single/double), the form works just fine including the calculations.

I have many other functions without the javascript section. I'm just wondering does the order of the functions matter inside the javascriot code? If not, then what is the cause of this then?
<script type="text/JavaScript">
function Packages() {
  var ptype = document.getElementById('package_type');
  ptype.value = "Single";
  ptype.value = "Double";
    <td height="23" colspan="3"><table width="486" height="23" border="0" cellpadding="0" cellspacing="0">
        <td width="66" height="25" class="tt"><label>
<input name="package" type="radio" value="single" id="single" onClick="Packages()">          
        <td width="6"></td>
        <td width="66" class="tt">
          <input name="package" type="radio" value="double" id="double" onClick="Packages()">
        <td width="290"></td>
        <td width="58"><input name="package_type" type="text" class="textarea" id="package_type" size="10" maxlength="10" ></td>
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros