# Calculating Form Text Fields?

**URL:** <https://forum.kirupa.com/t/calculating-form-text-fields/253357>\
**Category:** web dev\
**Created:** [February 29, 2008, 2:15pm UTC](https://forum.kirupa.com/t/calculating-form-text-fields/253357 "2008-02-29T14:15:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jderosa3](https://avatars.discourse-cdn.com/v4/letter/j/3be4f8/32.png) [@jderosa3](https://forum.kirupa.com/u/jderosa3)\
**Post date:** [February 29, 2008, 2:15pm UTC](https://forum.kirupa.com/t/calculating-form-text-fields/253357/1 "2008-02-29T14:15:02Z")

</div>

I am so close to having this mini form “calculator” finished… but I am stummped.

I made a calculator to approximate the specific gravity of Sucrose in a solution at 20 deg. C

Equation: X \* 0.00425 + 0.9988 = S.G. of Sucrose

my problem is that this for works, but it only does if you re-type the numbers that are predefined… here is my code… can someone tell me what I am doing wrong - it’s driving me bonkers.

```auto
 <table width="450" border="0" cellpadding="5" cellspacing="5" summary="A simple calculator to give a close approximation to the equivalent figure for the S.G. of Sucrose at 20 deg. C">
   <tr>
     <td width="221">Brix Value</td>
     <td width="194"><input type="text" id="Field1" /></td>
   </tr>
   <tr>
     <td>Multiplier</td>
     <td><input type="text" value="0.00425" id="Field2" /></td>
   </tr>
   <tr>
     <td>Add Factor</td>
     <td><input type="text" value="0.9988" id="Field3" /></td>
   </tr>
   <tr>
     <td>S.G. of Sucrose @ 20 deg C.</td>
     <td><input type="text" id="Total" /></td>
   </tr>
   <tr>
     <td>&nbsp;</td>
     <td><input type="button" value="Calculate S.G." id="btn" onclick="document.getElementById('Total').value=parseInt(document.getElementById('Field1').value)*parseInt(document.getElementById('Field2').value)+parseInt(document.getElementById('Field3').value);" /></td>
   </tr>
 </table>

```
