• Resolved hsntgm

    (@hsntgm)


    Hello,

    Maybe you can add this FAQ – Tip and Tricks | How to assign a value to a field that is not a calculated field from an equation?

    Checkboxes’s fields have multiple labels so if you don’t choose first element (main one) it overwrite all checkboxes’s titles.

    So you can use this code to assign a value to checkbox label that is not a calculated field from an equation or assign calculated field output to checkbox label.

    
    jQuery('.mycalss > label:first-child').html(Y);
    

    Complete code if you have a calculated value from an equation and want to assign it to checkbox label.

    
    (function(){
    var Y = fieldnameX;
    jQuery('.myclass > label:first-child').html(Y);
    return Y;
    })()
    

    Sincerely,

    • This topic was modified 7 years, 10 months ago by hsntgm.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @hsntgm,

    Thank you very much for sharing your solution, I will include this code in the plugin’s FAQs.

    Best regards.

    
    (function(){
    var Y = fieldnameX;
    jQuery('.myclass > label:first-child').html(Y);
    return Y;
    })()

    Just to clarify for anyone reading, this assigns the checkbox value to a calculated field output.

    Thanks for this but it is well beyond my skills!

    I am trying to complete a simple operation – if the person has a loan then to display fieldname3 (another calculated field) but if not then display 0.

    Fieldname1 (Do you have a loan – Yes/No checkbox)

    IF(Fieldname1=”Yes”,Fieldname3,0)

    What am I doing wrong as I can’t get it to work?

    Thanks

    Plugin Author codepeople

    (@codepeople)

    Hello @richardbuka,

    In javascript the operator for equality is the symbol: “==”, because the symbol: “=” is used for assignment, furthermore, javascript is a case sensitive language, and the correct fields names are: fieldname1, and fieldname3. So, the equation would be:

    IF(fieldname1=="Yes",fieldname3,0)

    Best regards.

    thanks a lot, working now!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Assign calculated field output to checkbox label.’ is closed to new replies.