cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
becko1001
Frequent Visitor

Change the value of a dropdown by clicking a button

Hi Everbody,

 

i'm looking for a solution to change the value of a dropdown (with values Yes/No)directly by clicking on a button (Save).

 

The value should not be changed by Submitting rather directly by clicking the button in the existing window/view

I'm looking around for a solution for a while but nothing is working properly.

 

Dropdown is called --> DataCardValue7

Button is called --> Save

 

I already tried it with 

OnSelect: 
UpdateContext({DataCardValue7:"Yes"});

but it wasn't changing the value in the dropdown.

 

Any ideas? Thanks for your help!

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @becko1001 ,

 

I think you can try to use combo box,  and set the Items of combo box as below:

Choices('SP list'.ChoiceColumnName)

Set the following formula to OnSelect of button

Set(Var,LookUp(Choices('SP list'.ChoiceColumnName),Value="Yes"))

Set the following formula to DefaultSelectedItems of combo box

If(IsBlank(Var),Parent.Default,Var)

Best regards,

Sik

If this post helps, then please click on “Accept as Solution” to help the other members find it more quickly.

 

View solution in original post

9 REPLIES 9
Anonymous
Not applicable

Why you use an Dropdown, when the button change the value? 

But to your question:

 

Button Onselect ->If(Dropdown1.Selected.Value ="Ja"; Set(VarP;"Nein");Set(VarP;"Ja"))

Dropdown1 Items -> ["Ja";"Nein"]

 

Dropdown1 Default -> VarP

 

v-siky-msft
Community Support
Community Support

Hi @becko1001 ,

 

What is the column type of that column? What is the data source?  Do you use drop down or combo box?

If the column type is Choices(SP list), please modify your formulas as below, note that don't use contril name as variable name.

Set(Var,LookUp(Choices('SP list'.ChoiceColumnName),Value="Yes"))

Set DefaultSelectedItems as below:

If(IsBlank(A1),Parent.Default,Var)

Best regards,

Sik

 

Hey Fatih1,

 

unfortunately your solution isn't working because the Default value says that it  is expecting an record value?

 

Any ideas to make it work?

Hi v-siky-msft,

 

your idea seems to be on the right way but what do i have to replace A1 with? Because A1 isn't working.

 

Best regards.

Hi  @becko1001 ,

 

Sorry for my mistake, please try this:

If(IsBlank(Var),Parent.Default,Var)

this formula is to show the defalut value from parent, if you haven't changed the value.

 

Best regards,

Sik

Hey Sik,

 

no shown error or something like that but the value in the dropdown(choices) didn't change.

 

Just to ask if i'm right:

 

This one is for Button.OnClick Event right?

Set(Var,LookUp(Choices('SP list'.ChoiceColumnName),Value="Yes"))

Is this one for Default valuer or for Items Value? I'm not sure If it is Default, what i have to use for Items?

If(IsBlank(A1),Parent.Default,Var) 

 

Best regards,

 

becko

Hi @becko1001 ,

 

I think you can try to use combo box,  and set the Items of combo box as below:

Choices('SP list'.ChoiceColumnName)

Set the following formula to OnSelect of button

Set(Var,LookUp(Choices('SP list'.ChoiceColumnName),Value="Yes"))

Set the following formula to DefaultSelectedItems of combo box

If(IsBlank(Var),Parent.Default,Var)

Best regards,

Sik

If this post helps, then please click on “Accept as Solution” to help the other members find it more quickly.

 

View solution in original post

Hey,

 

i've recognized that it's not working on the PC but working on my mobile device well! So i'm fine with that.

 

Any idea to lock the button after changing the value and to lock it directly if the value of the combobox is "no" ?

 

Thanks a lot for your help!

 

Best Regards,

becko

fpelky-oneida
Regular Visitor

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,567)