0

Hello,
I have a form that I need to add the feilds together as a total but it is not working.

I have a JS that is doing taking the value from a select box then multiplying by .2 after this is done it is writting the result to another form feild.

I need to then take all the values in the calculated form feilds and add them together to a total value.

After trying everything I can to get it to work using just JS I am stuck. I tried AJAX and thought I was good to go, but it is only working using * / and - but when trying to + it concatenates.

If anyone can help with this it would be very apperciated. This is the last hurddle to overcome and I can start testing my little app and start roll out.

Thanks
-jes

<script language="JavaScript">
var Review_Summary_Responsibilities_Rate=0;
var Review_Summary_Responsibilities_Rate_Total=0;
var Review_Summary_Essential_Functions_Rate=0;
var Review_Summary_Essential_Functions_Rate_Total=0;
var Review_Summary_Major_Objectives_Rate=0;
var Review_Summary_Major_Objectives_Rate_Total=0;
var Review_a360_Evaluation_Rate=0;
var Review_a360_Evaluation_Rate_Total=0;
var Review_Management_Functions_Rate=0;
var Review_Management_Functions_Rate_Total=0;

function myCalc() {

Review_Summary_Responsibilities_Rate=Math.abs(parseInt(document.form1.Review_Summary_Responsibilities_Rate.value));
Review_Summary_Essential_Functions_Rate=Math.abs(parseInt(document.form1.Review_Summary_Essential_Functions_Rate.value));
Review_Summary_Major_Objectives_Rate=Math.abs(parseInt(document.form1.Review_Summary_Major_Objectives_Rate.value));
Review_a360_Evaluation_Rate=Math.abs(parseInt(document.form1.Review_a360_Evaluation_Rate.value));
Review_Management_Functions_Rate=Math.abs(parseInt(document.form1.Review_Management_Functions_Rate.value));

document.form1.Review_Summary_Responsibilities_Rate_Total.value=(Review_Summary_Responsibilities_Rate*.2);
document.form1.Review_Summary_Essential_Functions_Rate_Total.value=(Review_Summary_Essential_Functions_Rate*.2);
document.form1.Review_Summary_Major_Objectives_Rate_Total.value=(Review_Summary_Major_Objectives_Rate*.2);
document.form1.Review_a360_Evaluation_Rate_Total.value=(Review_a360_Evaluation_Rate*.2);
document.form1.Review_Management_Functions_Rate_Total.value=(Review_Management_Functions_Rate*.2);

}
</script>

<table width="100%" border="1" cellpadding="0" cellspacing="0">
      <tr>
        <td width="31" valign="top" bgcolor="#D9D9D9">&nbsp;</td>
        <td width="285" align="center" valign="top" bgcolor="#D9D9D9"><p class="MsoListParagraph"><strong>Review Summary</strong></p></td>
        <td width="79" align="center" valign="top" bgcolor="#D9D9D9"><p class="MsoListParagraph"><strong>Rating</strong></p></td>
        <td width="93" align="center" valign="top" bgcolor="#D9D9D9"><p class="MsoListParagraph"><strong>Times</strong></p></td>
        <td width="121" align="center" valign="top" bgcolor="#D9D9D9"><p class="MsoListParagraph"><strong>Weight</strong></p></td>
        <td width="27" align="center" valign="top" bgcolor="#D9D9D9"><p class="MsoListParagraph">=</p></td>
        <td width="99" align="center" valign="top" bgcolor="#D9D9D9"><p class="MsoListParagraph"><strong>Earned Point Score</strong></p></td>
      </tr>
      <tr>
        <td width="31" valign="top"><p class="MsoListParagraph" style='line-height: normal'><strong>A</strong></p></td>
        <td width="285" valign="top"><p class="MsoListParagraph" style='line-height: normal'>Organizational Responsibilities </p></td>
        <td width="79" align="center" valign="top"><cfselect name="Review_Summary_Responsibilities_Rate" class="MsoListParagraph" id="Review_Summary_Responsibilities_Rate" onBlur="myCalc()">
          <cfif IsDefined("Get_Appraisal.Review_Summary_Responsibilities_Rate")>
		  <cfoutput><option value="#Get_Appraisal.Review_Summary_Responsibilities_Rate#" selected="selected">#Get_Appraisal.Review_Summary_Responsibilities_Rate#</option></cfoutput>
          </cfif>            
          <option value="0">Select Rate</option>
          <option value="4">4 Highly Effective</option>
          <option value="3">3 Successful</option>
          <option value="2">2 Improvement Needed</option>
          <option value="1">1 Unsatisfactory</option>
        </cfselect></td>
        <td width="93" valign="top"><p class="MsoListParagraph" align="center" style=' text-align:center;line-height:normal'>X </p></td>
        <td width="121" valign="top"><p class="MsoListParagraph" align="center" style=' text-align:center;line-height:normal'>20% </p></td>
        <td width="27" align="center" valign="top"><p class="MsoListParagraph" style='line-height: normal'>= </p></td>
        <td width="99" valign="top"><p class="MsoListParagraph">
        <cfinput type="text" name="Review_Summary_Responsibilities_Rate_Total" size="4" maxlength="4">
        </p></td>
      </tr>
      <tr>
        <td width="31" valign="top"><p class="MsoListParagraph" style='line-height: normal'><strong>B</strong></p></td>
        <td width="285" valign="top"><p class="MsoListParagraph" style='line-height: normal'>Accomplishment of Major Essential Functions </p></td>
        <td width="79" align="center" valign="top"><cfselect name="Review_Summary_Essential_Functions_Rate" class="MsoListParagraph" id="Review_Summary_Essential_Functions_Rate" onBlur="myCalc()">
          <cfif IsDefined("Get_Appraisal.Review_Summary_Essential_Functions_Rate")>
		  <cfoutput><option value="#Get_Appraisal.Review_Summary_Essential_Functions_Rate#" selected="selected">#Get_Appraisal.Review_Summary_Essential_Functions_Rate#</option></cfoutput>
          </cfif>            
          <option value="0">Select Rate</option>
          <option value="4">4 Highly Effective</option>
          <option value="3">3 Successful</option>
          <option value="2">2 Improvement Needed</option>
          <option value="1">1 Unsatisfactory</option>
        </cfselect></td>
        <td width="93" valign="top"><p class="MsoListParagraph" align="center" style=' text-align:center;line-height:normal'>X </p></td>
        <td width="121" valign="top"><p class="MsoListParagraph" align="center" style=' text-align:center;line-height:normal'>20% </p></td>
        <td width="27" align="center" valign="top"><p class="MsoListParagraph" style='line-height: normal'>= </p></td>
        <td width="99" valign="top"><p class="MsoListParagraph">
        <cfinput type="text" name="Review_Summary_Essential_Functions_Rate_Total" size="4" maxlength="4">
        </p></td>
      </tr>
      <tr>
        <td width="31" valign="top"><p class="MsoListParagraph" style='line-height: normal'><strong>C</strong></p></td>
        <td width="285" valign="top"><p class="MsoListParagraph" style='line-height: normal'>Accomplishment of Major Objectives </p></td>
        <td width="79" align="center" valign="top"><cfselect name="Review_Summary_Major_Objectives_Rate" class="MsoListParagraph" id="Review_Summary_Major_Objectives_Rate" onBlur="myCalc()">
          <cfif IsDefined("Get_Appraisal.Review_Summary_Major_Objectives_Rate")>
		  <cfoutput><option value="#Get_Appraisal.Review_Summary_Major_Objectives_Rate#" selected="selected">#Get_Appraisal.Review_Summary_Major_Objectives_Rate#</option></cfoutput>
          </cfif>            
          <option value="0">Select Rate</option>
          <option value="4">4 Highly Effective</option>
          <option value="3">3 Successful</option>
          <option value="2">2 Improvement Needed</option>
          <option value="1">1 Unsatisfactory</option>
        </cfselect></td>
        <td width="93" valign="top"><p class="MsoListParagraph" align="center" style=' text-align:center;line-height:normal'>X </p></td>
        <td width="121" valign="top"><p class="MsoListParagraph" align="center" style=' text-align:center;line-height:normal'>20% </p></td>
        <td width="27" align="center" valign="top"><p class="MsoListParagraph" style='line-height: normal'>= </p></td>
        <td width="99" valign="top"><p class="MsoListParagraph">
        <cfinput type="text" name="Review_Summary_Major_Objectives_Rate_Total" size="4" maxlength="4">
        </p></td>
      </tr>
      <tr>
        <td width="31" valign="top"><p class="MsoListParagraph" style='line-height: normal'><strong>D</strong></p></td>
        <td width="285" valign="top"><p class="MsoListParagraph" style='line-height: normal'>360 Evaluation/Gap Analysis </p></td>
        <td width="79" align="center" valign="top"><cfselect name="Review_a360_Evaluation_Rate" class="MsoListParagraph" id="Review_a360_Evaluation_Rate" onBlur="myCalc()">
          <cfif IsDefined("Get_Appraisal.Review_a360_Evaluation_Rate")>
		  <cfoutput><option value="#Get_Appraisal.Review_a360_Evaluation_Rate#" selected="selected">#Get_Appraisal.Review_a360_Evaluation_Rate#</option></cfoutput>
          </cfif>            
          <option value="0">Select Rate</option>
          <option value="4">4 Highly Effective</option>
          <option value="3">3 Successful</option>
          <option value="2">2 Improvement Needed</option>
          <option value="1">1 Unsatisfactory</option>
        </cfselect></td>
        <td width="93" valign="top"><p class="MsoListParagraph" align="center" style=' text-align:center;line-height:normal'>X </p></td>
        <td width="121" valign="top"><p class="MsoListParagraph" align="center" style=' text-align:center;line-height:normal'>20% </p></td>
        <td width="27" align="center" valign="top"><p class="MsoListParagraph" style='line-height: normal'>= </p></td>
        <td width="99" valign="top"><p class="MsoListParagraph">
        <cfinput type="text" name="Review_a360_Evaluation_Rate_Total" size="4" maxlength="4">
        </p></td>
      </tr>
      <tr>
        <td width="31" valign="top"><p class="MsoListParagraph" style='line-height: normal'><strong>E</strong></p></td>
        <td width="285" valign="top"><p class="MsoListParagraph" style='line-height: normal'>Management Functions </p></td>
        <td width="79" align="center" valign="top"><cfselect name="Review_Management_Functions_Rate" class="MsoListParagraph" id="Review_Management_Functions_Rate" onBlur="myCalc()">
          <cfif IsDefined("Get_Appraisal.Review_Management_Functions_Rate")>
		  <cfoutput><option value="#Get_Appraisal.Review_Management_Functions_Rate#" selected="selected">#Get_Appraisal.Review_Management_Functions_Rate#</option></cfoutput>
          </cfif>            
          <option value="0">Select Rate</option>
          <option value="4">4 Highly Effective</option>
          <option value="3">3 Successful</option>
          <option value="2">2 Improvement Needed</option>
          <option value="1">1 Unsatisfactory</option>
        </cfselect></td>
        <td width="93" valign="top"><p class="MsoListParagraph" align="center" style=' text-align:center;line-height:normal'>X </p></td>
        <td width="121" valign="top"><p class="MsoListParagraph" align="center" style=' text-align:center;line-height:normal'>20% </p></td>
        <td width="27" align="center" valign="top"><p class="MsoListParagraph" style='line-height: normal'>= </p></td>
        <td width="99" valign="top"><p class="MsoListParagraph">
        <cfinput type="text" name="Review_Management_Functions_Rate_Total" size="4" maxlength="4">
        </p></td>
      </tr>
      <tr>
        <td width="31" valign="top">&nbsp;</td>
        <td width="285" valign="top">&nbsp;</td>
        <td width="79" valign="top">&nbsp;</td>
        <td width="93" valign="top">&nbsp;</td>
        <td width="121" valign="top">&nbsp;</td>
        <td width="27" valign="top">&nbsp;</td>
        <td width="99" valign="top">&nbsp;</td>
      </tr>
      <tr>
        <td width="31" valign="top">&nbsp;</td>
        <td width="285" valign="top">&nbsp;</td>
        <td width="79" valign="top">&nbsp;</td>
        <td width="93" valign="top">&nbsp;</td>
        <td width="121" valign="top"><p class="MsoListParagraph" align="center" style=' text-align:center;line-height:normal'><strong>TOTAL</strong></p></td>
        <td width="27" align="center" valign="top"><p class="MsoListParagraph" style='line-height: normal'>= </p></td>
        <td width="99" valign="top"><p class="MsoListParagraph"> 
    <cfif IsDefined("Get_Appraisal.Performance_Summary_Total")>
    <cfinput type="text" name="Performance_Summary_Total" value="#Get_Appraisal.Performance_Summary_Total#" size="4" maxlength="4">
    <cfelse>
    <cfinput type="text" name="Performance_Summary_Total" size="4" maxlength="4" onfocus="document.getElementById(Performance_Summary_Total).value=document.getElementById(Review_Summary_Responsibilities_Rate_Total).value+document.getElementById(Review_Summary_Essential_Functions_Rate_Total).value)">
    </cfif>        
        
        </p></td>
      </tr>
    </table>
1
Contributor
2
Replies
3
Views
6 Years
Discussion Span
Last Post by kingjes
0

<body onload="document.form1.Review_Summary_Responsibilities_Rate.focus()">

<script language="JavaScript">
var Review_Summary_Responsibilities_Rate=0;
var Review_Summary_Responsibilities_Rate_Total=0;
var Review_Summary_Essential_Functions_Rate=0;
var Review_Summary_Essential_Functions_Rate_Total=0;
var Review_Summary_Major_Objectives_Rate=0;
var Review_Summary_Major_Objectives_Rate_Total=0;
var Review_a360_Evaluation_Rate=0;
var Review_a360_Evaluation_Rate_Total=0;
var Review_Management_Functions_Rate=0;
var Review_Management_Functions_Rate_Total=0;
var Performance_Summary_Total=0;

function myCalc() {

Review_Summary_Responsibilities_Rate=Math.abs(parseInt(document.form1.Review_Summary_Responsibilities_Rate.value));
Review_Summary_Essential_Functions_Rate=Math.abs(parseInt(document.form1.Review_Summary_Essential_Functions_Rate.value));
Review_Summary_Major_Objectives_Rate=Math.abs(parseInt(document.form1.Review_Summary_Major_Objectives_Rate.value));
Review_a360_Evaluation_Rate=Math.abs(parseInt(document.form1.Review_a360_Evaluation_Rate.value));
Review_Management_Functions_Rate=Math.abs(parseInt(document.form1.Review_Management_Functions_Rate.value));

document.form1.Review_Summary_Responsibilities_Rate_Total.value=(Review_Summary_Responsibilities_Rate*.2);
document.form1.Review_Summary_Essential_Functions_Rate_Total.value=(Review_Summary_Essential_Functions_Rate*.2);
document.form1.Review_Summary_Major_Objectives_Rate_Total.value=(Review_Summary_Major_Objectives_Rate*.2);
document.form1.Review_a360_Evaluation_Rate_Total.value=(Review_a360_Evaluation_Rate*.2);
document.form1.Review_Management_Functions_Rate_Total.value=(Review_Management_Functions_Rate*.2);

one = document.form1.Review_Summary_Responsibilities_Rate_Total.value;
two = document.form1.Review_Summary_Essential_Functions_Rate_Total.value;
three = document.form1.Review_Summary_Major_Objectives_Rate_Total.value;
four = document.form1.Review_a360_Evaluation_Rate_Total.value;
five = document.form1.Review_Management_Functions_Rate_Total.value;
document.form1.Performance_Summary_Total.value = (one * 1) + (two * 1) + (three * 1) + (four * 1) + (five * 1);
}
</script>

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.