Dropdown and text field linking

Certified Senior Developer

I have a dropdown field   called "Name" which has 3 values chintan, mantan and other

when the user selects other, a text field will be visible in which he can fill the other name.

the value entered in text field (other name)should get saved into name field 

how can I achieve this?

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer

    a!localVariables(
      local!list: { "Ramesh", "Somesh", "Other" },
      local!selectValue,
      local!otherValue,
      {
        a!dropdownField(
          label: "Name",
          choiceLabels: local!list,
          choiceValues: local!list,
          value: local!selectValue,
          saveInto: local!selectValue,
          placeholder: "Select a Value"
        ),
        a!textField(
          label: "other",
          showWhen: local!selectValue = "Other",
          value: local!otherValue,
          saveInto: {
            local!otherValue,
            if(
              contains(
                touniformstring(local!list),
                tostring(local!otherValue)
              ),
              "",
              a!save(
                local!list,
                append(local!list, local!otherValue)
              )
            )
          }
        )
      }
    )

Reply
  • 0
    Certified Senior Developer

    a!localVariables(
      local!list: { "Ramesh", "Somesh", "Other" },
      local!selectValue,
      local!otherValue,
      {
        a!dropdownField(
          label: "Name",
          choiceLabels: local!list,
          choiceValues: local!list,
          value: local!selectValue,
          saveInto: local!selectValue,
          placeholder: "Select a Value"
        ),
        a!textField(
          label: "other",
          showWhen: local!selectValue = "Other",
          value: local!otherValue,
          saveInto: {
            local!otherValue,
            if(
              contains(
                touniformstring(local!list),
                tostring(local!otherValue)
              ),
              "",
              a!save(
                local!list,
                append(local!list, local!otherValue)
              )
            )
          }
        )
      }
    )

Children
No Data