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

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (69,392)