• Resolved igonro

    (@igonro)


    I’m trying to set to certain value a field of type “calculated field” from the Javascript advanced equation editor.

    I know that if you return the value, it will appear in the form, but I have one function that computes several values (some values are dependent of other values) and in order to optimize my calculator I want to just use this function call to compute all the necessary fields.

    I noticed that CFF always replaces “fieldnameX” with the value of that field.

    Currently I use this:
    document.getElementById("fieldname" + "13_1").value = years;

    and it works, but, is there a more elegant way of using “fieldnameX” without replacing it?

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @igonro

    Yes, of course. you can use the following piece of code as part of the equation:

    
    getField(13).setVal(years);
    

    Best regards.

    Thread Starter igonro

    (@igonro)

    Thank you very much for your quick reply! This is what I was looking for.

    Best regards.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Set fieldname from javascript advanced equation’ is closed to new replies.