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
Options:
Thank you for your quick response, however i find it quite weird that changing components values doesn't trigger any saveInto, any reasons for that ?
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)
My problem is that by using another component's saveInto to save the default value, let's say i use "Tutu dropdown"'s saveInto for the example, which in my real life case is in another interface, i lose a lot of readability and create unwanted side effect.
If i later decide to add more elements in my "Foo dropdown"'s saveInto, when setting up my default value, i will have to duplicate the saveInto into another element in another interface to be sure that the default variable and the potential user input follows the same rules.
In my opinion it would leed to very bad interface design
So that's a definite side-effect of that option. Which is why I proposed the alternative: set a default value in process before the form is loaded, and then allow it to be altered (or not) by the user. Simple, clean and low/zero maintenance.
Ok i see now, thank you very much !
I'm unclear what you're trying to accomplish here. The apparent value of a dropdown at any given time hinges directly and exclusively on its "value" parameter (or the intersection of the current "value", as well as the choice Label at the same position as the choice Value that matches the current value of the "value" parameter). This is useful because you can change it externally "from above", for lack of a better term.
But "triggering the saveinto" is just... not a thing. It suggests to me that you don't quite firmly understand yet the directionality of how saveIntos work. I'd suggest boiling it down to a simpler, one-interface example, and getting used to how it works. This can later be expanded back to a multi-layered interface structure where one calls the other with rule inputs, etc.