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
Community Support
Community Support

Re: Change the value of a dropdown by clicking a button

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
Fatih1 Helper III
Helper III

Re: Change the value of a dropdown by clicking a button

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

 

Community Support
Community Support

Re: Change the value of a dropdown by clicking a button

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

 

becko1001
Frequent Visitor

Re: Change the value of a dropdown by clicking a button

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?

becko1001
Frequent Visitor

Re: Change the value of a dropdown by clicking a button

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.

Community Support
Community Support

Re: Change the value of a dropdown by clicking a button

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

becko1001
Frequent Visitor

Re: Change the value of a dropdown by clicking a button

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

Community Support
Community Support

Re: Change the value of a dropdown by clicking a button

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

becko1001
Frequent Visitor

Re: Change the value of a dropdown by clicking a button

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

Re: Change the value of a dropdown by clicking a button

Helpful resources

Announcements
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Power Platform 2020 release wave 1 plan

Power Platform 2020 release wave 1 plan

Features releasing from April 2020 through September 2020

Top Solution Authors
Top Kudoed Authors
Users online (9,085)