I wish to automatically calculate the length of a tube. Currently it makes a calculation like : length+dia=total. But I want to be able to input the dimensions and have the total in the fields in fractions and not in decimal.
Converting a decimal value into a fraction is quite problematic. Here are some web sites that explain it:
Convert Decimals to Fractions
To do this directly you need to guarantee that the decimal value is rational. Otherwise you can only get close, not right on.
Here is a website with a calculator that does it. I don't know for sure, but I suspect the conversion is done client side. If it is you can copy the JS code for your form.
Decimal to Fraction Calculator
Using fractions in a calculation is a different problem. Here's an online calculator. Again, if the code is client side you'll be able to copy it and use it on your form.
Online Fraction Calculators | Help With Fractions