How to clear field value after the field is disabled

I have two fields like this, only when "Yes" is selected for "Limited" field can user input value for "Limit" field. But I found when "Limit" is disabled, the value is still there.

How can I clear value after "Limit" is disabled?

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer

    Hi  

    Please have a look into this sample code. I hope this will helpful.

    a!localVariables(
      local!limited,
      local!limit,
      {
        a!cardLayout(
          contents: {
            a!radioButtonField(
              choiceLabels: { "Yes", "No" },
              choiceValues: { 1, 2 },
              label: "Limited ?",
              labelPosition: "ABOVE",
              value: local!limited,
              saveInto: {
                local!limited,
                a!save(local!limit,null)
               
              },
              choiceLayout: "STACKED",
              validations: {}
            ),
            a!integerField(
              label: "Limit",
              labelPosition: "ABOVE",
              value: local!limit,
              saveInto: { local!limit },
              refreshAfter: "UNFOCUS",
              validations: {},
              disabled: or(a!isNullOrEmpty(local!limited),local!limited=2)
              
              
            )
          },
          height: "AUTO",
          style: "TRANSPARENT",
          marginBelow: "STANDARD"
        )
      }
    )

Reply
  • 0
    Certified Senior Developer

    Hi  

    Please have a look into this sample code. I hope this will helpful.

    a!localVariables(
      local!limited,
      local!limit,
      {
        a!cardLayout(
          contents: {
            a!radioButtonField(
              choiceLabels: { "Yes", "No" },
              choiceValues: { 1, 2 },
              label: "Limited ?",
              labelPosition: "ABOVE",
              value: local!limited,
              saveInto: {
                local!limited,
                a!save(local!limit,null)
               
              },
              choiceLayout: "STACKED",
              validations: {}
            ),
            a!integerField(
              label: "Limit",
              labelPosition: "ABOVE",
              value: local!limit,
              saveInto: { local!limit },
              refreshAfter: "UNFOCUS",
              validations: {},
              disabled: or(a!isNullOrEmpty(local!limited),local!limited=2)
              
              
            )
          },
          height: "AUTO",
          style: "TRANSPARENT",
          marginBelow: "STANDARD"
        )
      }
    )

Children
No Data