cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
OwninJoe
Helper I
Helper I

Set Dropdown value with Button Click

Hey guys, i've been looking around trying to solve this problem, but it looks like most answers are from ~2 years ago and they're no longer working. I have a dropdown on my form that's called 'FormStatus' that's hidden. This is because the FormStatus comes from a sharepoint list and isn't directly editable by the user. I then have:

 

FormStatus.Default = FormStatusValue

 

And then the button click:

 

Button.OnClick = UpdateContext({FormStatusValue: "New"});

 

 Where "New" is a choice in the dropdown. But when I patch the form, the FormStatus is still blank. Any thoughts on why this is?

11 REPLIES 11
cds
Impactful Individual
Impactful Individual

"New" -> FormStatus.New

cds
Impactful Individual
Impactful Individual

or....

FormStatus.Default = FormStatus. & FormStatusValue

Hmmm, neither of these worked.

v-bofeng-msft
Community Support
Community Support

Hi @OwninJoe :

Could you tell me :

  • What is FormStatus? A combo box control or a drop down control?
  • What is FormStatus's Items proeprty?

If it is a drop down control.Please try:

Set the button's OnSelect property to:

 

UpdateContext({FormStatusValue: "New"});Reset(FormStatus)

 

11.gif

If it is a combo box,you should set it's DefaultSelectedItems property.

Best Regards,

Bof

 

@v-bofeng-msft,I apologize for the delay in getting back to you and thank you for your response. This is what I'm seeing when I try to implement the code you provided:

UpdateContext.png

what if you try this:

Button.OnClick = UpdateContext({FormStatusValue: {Value: "New"}});

I'm no longer seeing the error. But nothing happens on the button click. The dropdown still stays at whatever value it had before. For example, if it was "InProgress" before the button click, it's still "InProgress" after.

Hi @OwninJoe :

Could you tell me :

  • What is FormStatus? A combo box control or a drop down control?
  • What is FormStatus's Items proeprty?

If you can describe your app in detail to me, I might be able to help you better,I might be able to help you solve this problem

Best Regards,

Bof

FormStatus is a Combo Box, here's the onSelect and onchange

OwninJoe_1-1596480408723.png

Here's the OnSelect of the button:

OwninJoe_2-1596480442065.png

The possible options for FormStatus are "New", "HRSubmitted", or "ManagerSubmitted"

 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,976)