Skip to main content

Notifications

Power Apps - Building Power Apps
Unanswered

Change Dropdown Value in Form Via Button

(0) ShareShare
ReportReport
Posted on by

Hi,

 

I have a Form with a Dropdown box. I want to change the value shown in the Dropdown Box in the Form from "A" to "B" by selecting a button. What do I need to set and where?

 

Many Thanks!

Categories:
  • s_tanswell84 Profile Picture
    s_tanswell84 on at
    Re: Change Dropdown Value in Form Via Button

    Mmm - it didn't work 😞 I don't get an error but nothing happens) Here is what I have done:

    s_tanswell84_0-1698843275654.png

    s_tanswell84_1-1698843285236.png

    s_tanswell84_2-1698843302805.png

     

     

     

     

  • SpongYe Profile Picture
    SpongYe 5,358 on at
    Re: Change Dropdown Value in Form Via Button

    Ok, try changing the Default property of Dropdown1 to or leave the formula bar empty

    Parent.Default // or empty

     And then the DataCard1.Default of the Dropdown1:

    dropDownValue

     

    In my case I added this in my button to update the variable as a record for the dropdown: 

    // OnVisible property of the screen
    UpdateContext({
     dropDownValue: {Value: "A"}
    });
    
    // Button OnSelect
    UpdateContext({
     dropDownValue: {Value: "B"}
    })

     

    SpongYe_0-1698782604012.png

     

    If you have any questions or feedback, please let me know. Have a great day! 😊

    -----------------------
    PowerYsa Power Platform Enthusiast [LinkedIn] | [Youtube]

    I love to share my knowledge and learn from others. If you find my posts helpful, please give them a thumbs up 👍 or mark them as a solution ✔️. You can also check out my [@PowerYSA] for some cool solutions and insights. Feel free to connect with me on any of the platforms above. Cheers! 🍻

  • s_tanswell84 Profile Picture
    s_tanswell84 on at
    Re: Change Dropdown Value in Form Via Button

    Thanks! That worked if I moved the dropdown out of the Form (connected to a SharePoint List) but I got an error on the Dropdown box when it was in the form and tried to change the default property

  • SpongYe Profile Picture
    SpongYe 5,358 on at
    Re: Change Dropdown Value in Form Via Button

    Hi @s_tanswell84 

     

    Use the UpdateContext() function to set a variable that will store the new value of the dropdown box. 

    On the OnVisible property of the screen that contains the form: 

    UpdateContext({dropDownValue: "A"})

    Default property of Dropdown1:

    dropDownValue

    OnSelect property of Button1: 

    UpdateContext({dropDownValue: "B"})

    When you open the form, the dropdown box will show "A". When you click the button, the dropdown box will change to show "B".

     

    If you have any questions or feedback, please let me know. Have a great day! 😊


    -----------------------
    PowerYsa Power Platform Enthusiast [LinkedIn] | [Youtube]

    I love to share my knowledge and learn from others. If you find my posts helpful, please give them a thumbs up 👍 or mark them as a solution ✔️. You can also check out my [@PowerYSA] for some cool solutions and insights. Feel free to connect with me on any of the platforms above. Cheers! 🍻

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Kickstarter Events…

Register for Microsoft Kickstarter Events…

Tuesday Tip #12 Start your Super User…

Welcome to a brand new series, Tuesday Tips…

Tuesday Tip #13 Writing Effective Answers…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 144,858

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,505

Leaderboard