CalcBuilder Forum

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

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

Hi,

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

Hi,
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
CB("input").val(val1);


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

...
Support/development

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

Buy now!
...
CalcBuilder

Create dynamic calculators

Buy now!