I have 2 input boxes:
TextInput1
Default: testVar1
OnChange: Set(testVar2,Value(TextInput1.Text)*2)
TextInput2
Default: testVar2
OnChange: Set(testVar1,Value(TextInput2.Text)/2)
Default:
I change the 2nd box to 3 and the 1st box automatically changes to 1.5
I change the 1st box to 2 and the 2nd box automatically changes to 4
This works perfectly, however in my 2nd example:
Default:
I change the 2nd box to 3 and the 1st box automatically changes to 1.5
I change the 1st box back to 1, but the 2nd box stays at 3
I'm guessing that the 1st box OnChange doesn't register because I didn't manually set it to a different value even though the formula changed it to a different value. Is there a workaround to this issue?
I ended up finding a solution. Add a Reset() function to the end of OnChange.
TextInput1
Default: testVar1
OnChange: Set(testVar2,Value(TextInput1.Text)*2); Reset(TextInput2);
TextInput2
Default: testVar2
OnChange: Set(testVar1,Value(TextInput2.Text)/2); Reset(TextInput1);
Hi @RobinW ,
That is because OnChange only triggers when the user physically changes that value (not when a Variable that happens to be the Default changes)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
MVP (Business Applications) Visit my blog Practical Power Apps
WarrenBelz
146,645
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,997
Most Valuable Professional