cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sasrsc1966
Resolver I
Resolver I

Dropdown default for new items in a Form

This is my easy question of the day.... I have a dropdown list of Vendors (in a SP List called "Test-Vendors"). In my form I expect the user to select a value from the dropdown list of vendors... 
If the form is new - brand new record- I want the dropdown list to say "*** select a vendor ***". If existing record I'm editing ... of course I want it to show the value. I have this all done.... I'm not a fan of the allowEmptySelection as I prefer the visual of "select a vendor". I created a collection of an existing SP List and simply added the "select a vendor" and then appended the existing SP List. 
If this the correct way to do it (or best practice way) - now in the list if appears first which I want.

 

ClearCollect(
    VendorListing,
    {Title: "*** select a vendor ***"});
Collect(VendorListing,'Test-Vendors');

 Region Capture.jpg

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @sasrsc1966 ,

I do it exactly the same way as you when I need a "prompt" in a drop-down, but generally I use a Combo Box and set the InputTextPlaceholder to the required message and turn on Allow Searching so it displays.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

 

View solution in original post

4 REPLIES 4
WarrenBelz
Super User
Super User

Hi @sasrsc1966 ,

On the Default, try

If(
   YourFormName.Mode <> FormMode.New,
   ThisItem.YourFieldName
)

When in New Mode, it should Default to *** select a vendor *** if you have AllowEmptySelection set to false.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

My code works, sorry I wasn't clearer the question is really whether the method of creating that "label" for the top of the dropdown list is the best method. My SP List doesn't contain a row that says "***select a vendor***". I'm wanting to add that on the fly... for this Power App as I like the user experience better to see that than a blank dropdown value (as in allowEmptySelection).

Hi @sasrsc1966 ,

I do it exactly the same way as you when I need a "prompt" in a drop-down, but generally I use a Combo Box and set the InputTextPlaceholder to the required message and turn on Allow Searching so it displays.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

 

I don't think I have ever used the combobox so that's a very nice selling point for using a combobox instead as it saves you from, creating an extra collection too. Plus functionality wise it's essentially the say as a dropdown if you only allow single values.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Check out the New Ideas Site

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (4,028)