In my form, users input values which are used to calculate a result. The calculation is performed through AJAX calls triggered by onchange events on the user-edited fields. This process works as expected.
However, there is a hidden field that also gets updated via AJAX based on user input in one of the fields. Even though I can see that this update is successful and the value changes, the new value in the hidden field is not passed to the script for calculation. I suspect this is due to DOM changes made by JavaScript that need to be refreshed somehow, but I'm unsure how to accomplish this.
The calcPremium() function invokes the script responsible for the calculation and returns an array of results.
function calcPremium()
{
// Calculation variables
}
These functions manipulate the hidden field based on user inputs.
function calcRent() {
// Rent calculation logic
}
function setZoneRate(z) {
// Set zone rate based on input z
}
Below is an abbreviated version of the form:
<form action="" method="post" name="policyAddForm" id="policyAddForm">
// Form fields and inputs
</form>