I am tring to calculate a field on a form by mutiplying two other fields together. I keep getting NaN as the value.
I am using the on blur event on x_proj_value and x_proj_percent so that it populates a value into x_ext_value.
Here is what I have so far.
I am using the on blur event on x_proj_value and x_proj_percent so that it populates a value into x_ext_value.
Here is what I have so far.
Code:
<script language="javascript" type="text/javascript">
function calculateestvalue(){
var1=document.mainadd.x_proj_value;
var2=document.mainadd.x_proj_percent;
var1 = (var1=="")?0:var1;
var2 = (var2=="")?0:var2;
var3= var1*var2;
document.mainadd.x_est_value.value=var3;
}
</script>
<cfform onSubmit="return EW_checkMyForm(this);" name="mainadd" action="mainadd.cfm" method="post">
<input type="text" name="x_est_value"/>
<table class="ewTable">
<tr>
<td class="ewTableHeader">Proj Value </td>
<td class="ewTableAltRow"><input type="text" name="x_proj_value" size="30" maxlength="50" value="#HTMLEditFormat(x_proj_value)#" onblur="calculateestvalue()"> </td>
</tr>
<tr>
<td class="ewTableHeader">Proj Percent </td>
<td class="ewTableAltRow"><cfif x_proj_percent EQ ""><cfset x_proj_percent = 0></cfif><cfselect name="x_proj_percent" query="get_proj_percent" display="proj_percent" width="100" value="proj_percent" onblur="calculateestvalue()" ></cfselect> </td>
</tr>
</table>
</cfform>