cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted

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

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

 

Highlighted
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

 

Highlighted

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?

Highlighted

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.

Highlighted

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

Highlighted

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

Highlighted

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

Highlighted

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

Highlighted
Regular Visitor

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

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