Hi All,
I am facing a weird problem with respect to my combo box.
I have a combo box which shows Sizes (in decimals) on an Edit Form.
My problem is that anytime I edit a freshly added record, it keeps on showing the last added value in the combo box.
For ex: Add Tool 1 with size 1.00
Add Tool 2 with size 2.00
Add Tool 3 with size 3.00
Adding is not causing any problem. However, when I am editing the tool, it shows the last value as 3.00 as a default item in the dropdown.
I have tried all possible approaches as mentioned below:
1. Reset the dropdown using a context variable
2. Set the reset property to true
3. Set DefaultSelectedItems as [] or [""] (tried with both combinations)
4. Cleared the default property of the combo box as well as that of the data card.
I am pretty clueless as to why it is retaining that old value from the last "add" operation.
Any suggestions?
Thanks,
--Ashep
Solved! Go to Solution.
Hey @Anonymous, what has worked for me is to create a context variable that toggles the reset from true to false and back to true. One common pattern I have used is to set the value to true in the OnVisible property of the screen with the control I am trying to reset and then setting the value to false in the OnHidden property of the same screen.
// Reset property of the control ResetControl // OnVisible property of the screen the control is on UpdateContext({ResetControl: true}) // OnHidden property of the screen the control is on UpdateContext({ResetControl: false})
I have also stacked a toggle for instances where I wasn't changing screens but had a submit button. Basically something like:
// In the submit button OnSelect property AFTER the submit action has taken place
UpdateContext({ResetControl: false}); UpdateContext({ResetControl: true})
Maybe try that out and let me know how it goes?
Hey @Anonymous, what has worked for me is to create a context variable that toggles the reset from true to false and back to true. One common pattern I have used is to set the value to true in the OnVisible property of the screen with the control I am trying to reset and then setting the value to false in the OnHidden property of the same screen.
// Reset property of the control ResetControl // OnVisible property of the screen the control is on UpdateContext({ResetControl: true}) // OnHidden property of the screen the control is on UpdateContext({ResetControl: false})
I have also stacked a toggle for instances where I wasn't changing screens but had a submit button. Basically something like:
// In the submit button OnSelect property AFTER the submit action has taken place
UpdateContext({ResetControl: false}); UpdateContext({ResetControl: true})
Maybe try that out and let me know how it goes?
Hi @Anonymous ,
Firstly, do you want to change the combo box's defaultselecteditem or drop down's defaultselected value?
Secondly, do you want to set the combo box's defaultselecteditem to blank?
The reason why the combo box's DefaultSelectedItems is the latest value is that: it is set to Parent.Default, so it will display the value that the form is binging with.
If you want to chang it, just unlock the combo box and delect the setting of the DefaultSelectedItems.
Then, the combo box in edit form will display blank.
Best regards,
Community Support Team _ Phoebe Liu
Thanks for your reply. Putting the context variable on the OnVisible event seems to have fixed the issue.
Hi @Anonymous ,
I'm glad that you've solved your problem.
If you do not have any other problem, could you please mark my answer as the solution?
Thanks!
Best regards,
Community Support Team _ Phoebe Liu