garethtnash
asked on
Javascript Calculation
Hello,
I have a or with a number of input options -
I would like it if
TotalRetainer was a calculated value based on the input into either or both of -
So if only FeeCommision is entered the value in TotalRetainer is the same as the value in FeeCommission, OR if both are entered the value is the Sum of both.
The calculation needs to happen on blur of either input.
And nost importantly, the input needsto be updateable, so if the sum of both is 10, but more parameters are involved and the actual total is 12, the user can over write the javascript calculated value...
Appreciate any help you can offer - Many thanks
I have a or with a number of input options -
<form action="" method="post" name="form1" id="form1" onsubmit="return validateform1(this)">
<h3>Complete Survey Now</h3>
<ul>
<li>
<label>Retainer Value :</label>
<input name="Locality" type="hidden" id="Locality" value="<%=(RSMemberLocality.Fields.Item("Locality").Value)%>" /> <input name="Retainerinput" type="hidden" id="Retainerinput" value="yes" />
<input name="RetainerValue" type="text" id="RetainerValue" maxlength="8" onBlur="this.value = formatField(this)" />
</li>
<li>
<label>Fee Commission :</label>
<input name="FeeCommission" type="text" id="FeeCommission" maxlength="8" onBlur="this.value = formatField(this)" />
</li>
<li>
<label>Total :</label>
<input name="TotalRetainer" type="text" id="TotalRetainer" maxlength="8" onBlur="this.value = formatField(this)" />
</li>
<li>
<label>Date of Review </label>
<input type="text" id="ReviewDate" name="ReviewDate" />
</li>
<li>
<label>Comments</label>
<div class="retainerholdertextarea"><textarea name="Comments" cols="36" rows="5" id="Comments"></textarea></div>
<input type="image" class="submitbutton" src="png/submit.png">
</li>
</ul>
</form>
I would like it if
TotalRetainer was a calculated value based on the input into either or both of -
RetainerValue
FeeCommission
FeeCommission
So if only FeeCommision is entered the value in TotalRetainer is the same as the value in FeeCommission, OR if both are entered the value is the Sum of both.
The calculation needs to happen on blur of either input.
And nost importantly, the input needsto be updateable, so if the sum of both is 10, but more parameters are involved and the actual total is 12, the user can over write the javascript calculated value...
Appreciate any help you can offer - Many thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi COBOLdinosaur,
Thanks for the post, but sadly no joy..
Thanks
Thanks for the post, but sadly no joy..
Thanks
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Guys
ASKER
I've tried -
<script>
<!--
function calc(RetainerValue,FeeComm
var one = document.getElementById(Re
var two = document.getElementById(Fe
document.getElementById(SU
}
//-->
</script>
AND
<td><input name="Locality" type="hidden" id="Locality" value="<%=(RSMemberLocalit
<input name="RetainerValue" type="text" id="RetainerValue" maxlength="8" onBlur="this.value = formatField(this);calc('on
</tr>
<tr class="altrow">
<td class="labelcolumn">Fee Commission :</td>
<td><input name="FeeCommission" type="text" id="FeeCommission" maxlength="8" onBlur="this.value = formatField(this);calc('on
</tr>
<tr>
<td class="labelcolumn">Total :</td>
<td><input name="TotalRetainer" type="text" id="TotalRetainer" maxlength="8" onBlur="this.value = formatField(this)" /></td>
But no joy -
Thanks