Skip to main content

Showing checkboxes checked when values are the same

Comments

5 comments

  • Prajakta

    It is not possible to have two options with same value. You will have to make each option value unique by appending a letter or some such to it. Then strip that letter while doing the calculations.

    Please see this rule example that shows how to set/unset checkbox options.

    0
  • Mike Griffith

    I tried that and ran into some road blocks.  I'm finding it hard to find/write code to work in IDE and then it also work in frevvo.  Which is why I ending up asking this question because the calculations work if i could just have the checkboxes reflect they are really checked.  

    How would I get something like this https://www.w3schools.com/code/tryit.asp?filename=FZYAC9U7QG0T to work in frevvo?

    0
  • Prajakta

    Hi Mi,e

    Set your checkbox options property like this so the all options have unique values:

    100a=100-Registration
    100b=100-Airfare
    300=300-Meals

    Then use a rule like this to strip the letters from values and total them:

    var sum = 0;
    var event = form.load || Repeat99.itemRemoved || Repeat99.itemAdded;
    for (let i = 0; i < Money103.value.length; i++) {
    if (Boolean(Money103[i].value)) {
    for (let j = 0; j < Money103[i].value.length; j++){
    sum = sum + Number(Money103[i].value[j].replace(/[^0-9]/, ''));
    }
    Money97[i].value = sum;
    sum = 0;
    }
    }

    I tried this rule in the same form that you had attached in your previous post.

    0
  • Mike Griffith

    Got me on the right track, thank you. Ended up with the dynamic options being set like ex.

    100Registration=100-Registration
    100Airfare=100-Airfare
    300Meals=300-Meals

    Then changed regex to

    /[^0-9]/g

    Any ideas on

    And to take it a step further, is there a way in the repeats to disable any checkboxes that have been checked in another repeat, so that option/name can only be checked once in any repeat?

    0
  • Prajakta

    It is not possible to disable only specific options. However, you can remove those options that you don't want the user to select using business rules. See these rule examples for setting checkbox options and values using rules.

    Our Services team can help you build these rules if you like. You have 7.5 hours of Services time available. They can use some of that time to help you with these rules. Let us know if you would like to do that.

     

    0

Please sign in to leave a comment.