Wanting to add a age block into the calculation for body fat
I found the following java script and it works. But i would like to add the use of Age into the calculation for body fat. Not sure if it can be done with out a major overhaul of the script. But figured it wouldnt hurt to reach out and see. Also, this is on a form that we use for work and I am trying to make it better. It would make our basic pre qualification process much easier to have the body fat calculation ahead of time.
The following is the script that works but does not have age involved. I feel like it could be more accurate with age involved in it.
(function () {
// Get the field values, as text
var weight = +getField("E7. a. 2. Weight").value;
var feet = +getField("E7. a. 1. Height").value;
var inches = +getField("E7. a. 1. Feet").value;
var height = (feet * 12) + inches;
// Perform the calculation if both values are greater than zero
if (weight > 0 && height > 0) {
event.value = 703 * weight / Math.pow(height, 2);
} else {
event.value = ""; // Blank this field
}
})();
