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 Associate Developer

    Hi, You can use below code 

    a!localVariables(
              local!Choicevalue: {1,2,3},
              local!values,
              local!OtherName,
    a!sectionLayout(
          contents: {
               a!dropdownField(
                    label: "Name",
                   placeholder: "select a name",
                   choiceLabels: ri!DropDownValues,
                   choiceValues: local!Choicevalue,
                   value: local!values,
                   saveInto: local!values
      ),
    a!textField(
             label: "Name",
             value: local!OtherName,
             saveInto: local!OtherName,
             showWhen: if(tointeger(local!values)=3,true(),false())
        )
      }
     )

    )

    Here, I have made one rule input for dropdown field and use a local!values for saving the dropdown values, 

    And in text field you can use showwhen when other option is selected then text field show other it can't show.

Reply
  • 0
    Certified Associate Developer

    Hi, You can use below code 

    a!localVariables(
              local!Choicevalue: {1,2,3},
              local!values,
              local!OtherName,
    a!sectionLayout(
          contents: {
               a!dropdownField(
                    label: "Name",
                   placeholder: "select a name",
                   choiceLabels: ri!DropDownValues,
                   choiceValues: local!Choicevalue,
                   value: local!values,
                   saveInto: local!values
      ),
    a!textField(
             label: "Name",
             value: local!OtherName,
             saveInto: local!OtherName,
             showWhen: if(tointeger(local!values)=3,true(),false())
        )
      }
     )

    )

    Here, I have made one rule input for dropdown field and use a local!values for saving the dropdown values, 

    And in text field you can use showwhen when other option is selected then text field show other it can't show.

Children
No Data