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

Change dropdown value OnSelect

Hello! 

 

I am trying to change the value of a few dropdowns when a user clicks a button, but it's not changing any fo the values.

I expected something as simple as this to work in the "OnSelect" property of the button.

 

CorrectiveDatePicker.SelectedDate = Today();
CorrectiveHourPicker.Selected.Value = "12";
CorrectiveMinutePicker.Selected.Value = "00";
CorrectiveAMPMPicker.Selected.Value = "AM";
CorrectiveActionDetailsInput.Text = ""

 

Is there a way to update the values in dropdowns and text inputs when selecting a button? 

7 REPLIES 7
Highlighted
Super User
Super User

Re: Change dropdown value OnSelect

Yes, but a slightly different way.

 

Set the Default of each of the inputs to be a variable. Then when you change the Dropdown have the OnChange property update the variable. The inputs will automatically reflect the change.

 

This sounds like a great idea for a video. Smiley Happy 

Shane - Microsoft MVP, YouTube, and PowerApps Consulting for when you are in a bind to get this fixed quickly. And finally we now have PowerApps Training
BrandonMcG
Level: Powered On

Re: Change dropdown value OnSelect

Thanks for the idea for the text input! How would that work for setting the dropdown values? I am not quite grasping how to change the values.. 

 

Would it then just be this? 

Button1.OnSelect = CorrectiveDatePicker.SelectedDate = Default();
CorrectiveHourPicker.Selected.Value = Default();
CorrectiveMinutePicker.Selected.Value = Default();
CorrectiveAMPMPicker.Selected.Value = Default();
CorrectiveActionDetailsInput.Text = Default()

 

Super User
Super User

Re: Change dropdown value OnSelect

On my main dropdown I have set the OnChange Property to:

 

UpdateContext({BrandonVariable: Dropdown1.Selected.Value})

 

Brandon1.PNG

 

For My TextInput and dropdown2 I have set to Default to:

 

BrandonVariable

 

Now when I change my dropdown (select the number 2 for example) the TextInput shows 2.

 

Shane - Microsoft MVP, YouTube, and PowerApps Consulting for when you are in a bind to get this fixed quickly. And finally we now have PowerApps Training
BrandonMcG
Level: Powered On

Re: Change dropdown value OnSelect

I'm not "OnChange" any of the dropdown... I'm trying to reset it's value when a button is clicked. 

 

This seems to work.

UpdateContext({DetailsDefault: "", Dropdown1Default: "12"})

 

Setting the DefaultDate of the Date Picker is still not working, but definitely getting somewhere.

 

Next time I will 100% use a form. 

BrandonMcG
Level: Powered On

Re: Change dropdown value OnSelect

I think what's happening is that the screen isn't being "refreshed" when being navigated away from, and then back to. The "OnVisible" doesn't run again so the context doesn't change. It's only on the first application run that it will update

Harikrishnan
Level: Powered On

Re: Change dropdown value OnSelect

Have you got a solution for this? I'm also trying to set a dropdown selection on button click. I'm able to set the value for a textbox using set/update context. But for the dropdown same logic is not working. I also tried to create a collection with a single value and set that as Default/DefaultSelectedItems for the dropdown. There was no syntax error but still its not selecting the dropdown value. Any help on this will be appreciated.

Mark2457
Level: Powered On

Re: Change dropdown value OnSelect

did you ever figure this out. I have same issue

 

Thanks

 

mark

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Demo Extravaganza Championship Voting Open

Voting Ends: October 30, 2019!

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 187 members 4,691 guests
Please welcome our newest community members: