{"id":756,"date":"2023-01-21T08:47:16","date_gmt":"2023-01-21T13:47:16","guid":{"rendered":"https:\/\/www.dontpapanic.com\/blog\/?p=756"},"modified":"2023-01-21T08:54:55","modified_gmt":"2023-01-21T13:54:55","slug":"setting-selected-text-in-a-pa-dropdown","status":"publish","type":"post","link":"https:\/\/www.dontpapanic.com\/blog\/?p=756","title":{"rendered":"Setting Selected Text in a PA Dropdown"},"content":{"rendered":"<p><a href=\"https:\/\/www.dontpapanic.com\/blog\/wp-content\/uploads\/2023\/01\/dropdown.png\"><img loading=\"lazy\" decoding=\"async\" width=\"244\" height=\"218\" title=\"dropdown\" align=\"left\" style=\"margin: 0px 10px 10px 0px; float: left; display: inline; background-image: none;\" alt=\"dropdown\" src=\"https:\/\/www.dontpapanic.com\/blog\/wp-content\/uploads\/2023\/01\/dropdown_thumb.png\" border=\"0\"><\/a>A common question that I\u2019ve run into again lately is how can I set the Selected or Selected Text property of a dropdown control in a Canvas App when there is NO Selected property?&nbsp; The key to solving this problem is understanding the interaction between two other aspects in Power Apps.&nbsp; They are the default property of the Dropdown and the Reset() function in Power Apps.&nbsp; Lets look at how each of these work and how they interact.<\/p>\n<h2>Dropdown Default Property<\/h2>\n<p>Setting the initial value in a dropdown is as easy as setting the default property of the control.&nbsp; When the control first loads it will look at the default property to set the initial value of the controls. The problem is that once a user has interacted with the control the default setting will be ignored. This is where the Reset() function comes in.<\/p>\n<h2>Reset() Function<\/h2>\n<p>The Reset() function in Power Apps is specifically designed to reset a given control back to their Default settings.&nbsp; Adding Reset(&lt;&lt;DropDown&gt;&gt;); to the end of an OnSelect that Patches or Submits a form will clear the user\u2019s input and reset the Dropdown back to its original default value.<\/p>\n<h2>Try it Yourself<\/h2>\n<ol>\n<li><strong>Add<\/strong> a <em>Dropdown<\/em> and a <em>Button<\/em> to a <strong>Screen<\/strong> in a Power App<\/li>\n<li><strong>Set<\/strong> the <em>Default<\/em> property of the <strong>Dropdown<\/strong> to<em> \u201c2\u201d<\/em><\/li>\n<li><strong>Type<\/strong>&nbsp;<em>reset(Dropdown1) <\/em>into the <strong>OnSelect<\/strong> Property of the <strong>Button<\/strong><\/li>\n<\/ol>\n<p>When you run the app the dropdown will default to 2. Use the dropdown to select 3 as the chosen value. Navigate to a different screen and back again.&nbsp; The dropdown will be set to 3. Press the button.&nbsp; The dropdown selected value will change to 2<\/p>\n<p>This functionality works on most controls with minor variations.&nbsp; Its the same for TextInput boxes, but for ComboBoxes you set DefaultSelectedItems to a record containing the value of the default selection.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A common question that I\u2019ve run into again lately is how can I set the Selected or Selected Text property of a dropdown control in a Canvas App when there is NO Selected property?&nbsp; The key to solving this problem is understanding the interaction between two other aspects in Power Apps.&nbsp; They are the default &hellip; <a href=\"https:\/\/www.dontpapanic.com\/blog\/?p=756\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Setting Selected Text in a PA Dropdown<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[107],"tags":[117],"class_list":["post-756","post","type-post","status-publish","format-standard","hentry","category-powerapps","tag-power-apps"],"_links":{"self":[{"href":"https:\/\/www.dontpapanic.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/756","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dontpapanic.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dontpapanic.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dontpapanic.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dontpapanic.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=756"}],"version-history":[{"count":3,"href":"https:\/\/www.dontpapanic.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/756\/revisions"}],"predecessor-version":[{"id":761,"href":"https:\/\/www.dontpapanic.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/756\/revisions\/761"}],"wp:attachment":[{"href":"https:\/\/www.dontpapanic.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=756"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dontpapanic.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=756"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dontpapanic.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=756"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}