Trigger saveInto when dynamically changing value in dropdown

Hello,

I have an interface that needs to show default value in dropdown for my users when some options are specified (see example below) 

  {
    a!DropdownField(
      label: "Toto dropdown",
      choiceLabels: {"1", "2", "3"},
      choiceValues: {1, 2, 3},
      value: ri!toto
    ),
    a!DropdownField(
      label: "Tutu dropdown",
      choiceLabels: {"4", "5", "6"},
      choiceValues: {1, 2, 3},
      value: ri!tutu
    ),
    a!DropdownField(
      label: "Foo dropdown",
      choiceLabels: {"Test", "Test2"},
      choiceValues: {140, 150},
      value: if(
        and(
          isnull(ri!foo), 
          a!isNotNullOrEmpty(ri!toto), 
          a!isNotNullOrEmpty(ri!tutu)
        ),
        if(
          and(ri!toto = 1, ri!tutu = 2), 
          140, 
          150
        ), 
        ri!foo
      ),
      saveInto: ri!foo
    )
  }

This interface is embedded in a form component, when i submit this form and the default value of the "Foo dropdown" hasn't been changed, since its saveInto aren't triggered, i can't retrieve the values in ri!foo.

I really need this default value system, how can i trigger those saveInto ? 

  Discussion posts and replies are publicly visible

Parents Reply
  • saveInto's are only triggered by user-interactions with the component within which they are contained. So unless you actually interact with the 'foo dropdown' component as an end-user its 'saveInto' won't be triggered. Hence the suggestions to either pre-populate the value so that it is defaulted when you first arrive (and where any subsequent interactions overwrite your default value) or you use another component's 'saveInto' (in this case your 'submit' button on the form) to set the desired value (which you can do conditionally e.g. only set the value the current value is, say, null)

Children