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"> </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"> </td>
<td width="285" valign="top"> </td>
<td width="79" valign="top"> </td>
<td width="93" valign="top"> </td>
<td width="121" valign="top"> </td>
<td width="27" valign="top"> </td>
<td width="99" valign="top"> </td>
</tr>
<tr>
<td width="31" valign="top"> </td>
<td width="285" valign="top"> </td>
<td width="79" valign="top"> </td>
<td width="93" valign="top"> </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>