CalcBuilder Forum

intial value of a text field to be equal the value of another field

User road9media 2015-09-20 12:29:54


I need the initial value of a text field to be equal to an inline field value as a start till user changes its value.

Moonsoft support 2015-09-21 09:50:58

you can copy the value between two input fields at the time the form loads, using the first js tab of your calculator and this code:

//recover value from yourfield1
var val1=CB("input").val();
//assing to input yourfield2

But at this time the inline results are not present at your page yet, as they are values returned by the calculator (server). You can only recover inline contents once the calculation has returned (at the 'Executed after calculate execution' tab). Here we share the code used to recover content from an inline section:

//replace inlinefld for your own inline field name
var val1=CB("div").html();

Hope this helps


Perfect for small code changes or to correct any bug at your site

Buy now!
Support/development 40 hours

With the peace of mind of having a professional team at your service (20% discount)

Buy now!