cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AShep
Level: Powered On

Combo box retains old value in edit form

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Combo box retains old value in edit form

Hey @AShep, 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?

View solution in original post

4 REPLIES 4
Super User
Super User

Re: Combo box retains old value in edit form

Hey @AShep, 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?

View solution in original post

Community Support Team
Community Support Team

Re: Combo box retains old value in edit form

Hi @AShep ,

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.792.png

 

 

Best regards,

Community Support Team _ Phoebe Liu

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
AShep
Level: Powered On

Re: Combo box retains old value in edit form

Thanks for your reply. Putting the context variable on the OnVisible event seems to have fixed the issue.

Community Support Team
Community Support Team

Re: Combo box retains old value in edit form

Hi @AShep ,

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

 

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Kudoed Authors (Last 30 Days)
Users online (4,096)