disabled radio buton

Certified Associate Developer

ihave one radio button in editable grid so when i select one option it should be disabled how can i do it

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Hi ,

    You could use the disable property of a component to disable it and code it according to your selected value.

    Here's a eg code snippet. It disables a text field when the radio button has a specific value (3 here)

    You can use the local disableSelection variable to disable the radiobutton too / any other components similarly

    a!gridLayout(
      headerCells: {
        a!gridLayoutHeaderCell(label: "Radio Button"),
        a!gridLayoutHeaderCell(label: "Data")
      },
      rows: a!gridRowLayout(
        contents: {
          a!localVariables(
            local!radioButton: null,
            local!disableSelection: false(),
            local!textbox,
            {
              a!radioButtonField(
                choiceLabels: { "One", "Two", "Three" },
                choiceValues: { 1, 2, 3 },
                value: local!radioButton,
                saveInto: {
                  local!radioButton,
                  /*Disable selection of Text field when value is 3*/
                  a!save(local!disableSelection, save!value = 3)
                }
              ),
              a!textField(
                value: local!textbox,
                saveInto: local!textbox,
                disabled: local!disableSelection
              )
            }
          )
        }
      )
    )

Reply
  • 0
    Certified Lead Developer

    Hi ,

    You could use the disable property of a component to disable it and code it according to your selected value.

    Here's a eg code snippet. It disables a text field when the radio button has a specific value (3 here)

    You can use the local disableSelection variable to disable the radiobutton too / any other components similarly

    a!gridLayout(
      headerCells: {
        a!gridLayoutHeaderCell(label: "Radio Button"),
        a!gridLayoutHeaderCell(label: "Data")
      },
      rows: a!gridRowLayout(
        contents: {
          a!localVariables(
            local!radioButton: null,
            local!disableSelection: false(),
            local!textbox,
            {
              a!radioButtonField(
                choiceLabels: { "One", "Two", "Three" },
                choiceValues: { 1, 2, 3 },
                value: local!radioButton,
                saveInto: {
                  local!radioButton,
                  /*Disable selection of Text field when value is 3*/
                  a!save(local!disableSelection, save!value = 3)
                }
              ),
              a!textField(
                value: local!textbox,
                saveInto: local!textbox,
                disabled: local!disableSelection
              )
            }
          )
        }
      )
    )

Children
No Data