• Resolved chrisdias96

    (@chrisdias96)


    Hi there,

    I have checkbox A and checkbox B. I want checkbox B to be ticked when checkbox A is ticked.

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

    (@codepeople)

    Hello @chrisdias96

    Thank you so much for using our plugin. I’ll try to describe the process with a hypothetical example. Assuming the checkbox fields are fieldname123 and fieldname321.

    Please, insert a calculated field in the form and enter the following piece of code as its equation:

    getField(321).setVal(fieldname123|r);

    And that’s all.

    getField receives the numeric part of the field’s name and returns its object representation.

    Best regards.

    Thread Starter chrisdias96

    (@chrisdias96)

    Hi,

    That did not work. I added your code into a field that checks if fieldname106 is true and performs a calculation.

    I ticked fieldname106 to true, and fieldname108 did not get ticked true along with it.

    Plugin Author codepeople

    (@codepeople)

    Hello @chrisdias96

    Please, send me the link to your form to check your equation in action.

    Best regards.

    Thread Starter chrisdias96

    (@chrisdias96)

    test form here

    fieldname106 should be checked when fieldname108 is checked.

    Plugin Author codepeople

    (@codepeople)

    Hello @chrisdias96

    The code is not working because the fields have different values. You cannot use the setVal method because the values of the fieldname106 and fieldname108 are different. In your case, please, use the following piece of code:

    getField(106).jQueryRef().find('input').prop('checked', fieldname108);

    Best regards.

    Thread Starter chrisdias96

    (@chrisdias96)

    Hi codepeople,

    That works, but now that has disabled functionality of fieldname106. I still want to be able to uncheck 106. f108 requires f106 to be enabled, but f106 does not require f108 to be enabled. I can no longer manually enable or disable it.

    Plugin Author codepeople

    (@codepeople)

    Hello @chrisdias96

    You are using the code as part of another equation. So it is executed every time the equation is evaluated.

    Please, insert a calculated field only to evaluate this code as its equation. You can hide the new calculated field by ticking a checkbox in its settings.

    Best regards.

    Thread Starter chrisdias96

    (@chrisdias96)

    Thanks,

    I separated it and does work. However, I have calculated field121 that has dependent of f106 and should go through some calculations. But since f106 is being ticked through f108, it doesn’t show the dependent field 121 or perform the calculations. Am I missing something?

    Plugin Author codepeople

    (@codepeople)

    Hello @chrisdias96

    If you have dependent fields, you should trigger the onchange event:

    getField(106).jQueryRef().find('input').prop('checked', fieldname108).change();

    Please, if you need a custom coding service to implement your project, it is required you contact me through the plugin website: Custom Coding Service

    Best regards.

    Thread Starter chrisdias96

    (@chrisdias96)

    Thank you for your help! It’s working.
    Amazing how one word or line can change the whole thing.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Select Checkbox using another checkbox’ is closed to new replies.