CheckBox visibility Function

i want to display a text box only when a check box is been clicked. what can i do to achieve that?

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Associate Developer

    hi, if you want to display specific box or multiple boxes while selecting the check box, then you can modify the below code as you desire.

    a!localVariables(
      local!selectedBox,
      {
        a!checkboxField(
          choiceLabels: { "a", "b" },
          choiceValues: { 1, 2 },
          value: local!selectedBox,
          saveInto: local!selectedBox,
    
        ),
        a!textField(
          showWhen: {
            and(
              a!isNotNullOrEmpty(local!selectedBox),
              local!selectedBox = 1
            )
          },
          label: "text field 1"
        ),
        a!textField(
          showWhen: {
            and(
              a!isNotNullOrEmpty(local!selectedBox),
              local!selectedBox = 2
            )
          },
          label: "text field 2"
        )
      }
    )

Reply
  • 0
    Certified Associate Developer

    hi, if you want to display specific box or multiple boxes while selecting the check box, then you can modify the below code as you desire.

    a!localVariables(
      local!selectedBox,
      {
        a!checkboxField(
          choiceLabels: { "a", "b" },
          choiceValues: { 1, 2 },
          value: local!selectedBox,
          saveInto: local!selectedBox,
    
        ),
        a!textField(
          showWhen: {
            and(
              a!isNotNullOrEmpty(local!selectedBox),
              local!selectedBox = 1
            )
          },
          label: "text field 1"
        ),
        a!textField(
          showWhen: {
            and(
              a!isNotNullOrEmpty(local!selectedBox),
              local!selectedBox = 2
            )
          },
          label: "text field 2"
        )
      }
    )

Children
No Data