cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dfin
Frequent Visitor

Dropdown default value - set to blank value?

I have an edit screen with two dropdowns controls.  The first dropdown is Client and the sceond is ClientProject.  After choosing the client, the user can seleect the specific project for the client.  The ClientProject dropdown is filtering it's list values based on the value of the Client dropdown.

 

When adding a new record, though, after I select a client, the Client Project dropdown always gets set to the first value on the list.  I would preer that it would be left blank.  Is this possible?

 

Thanks,

Dave

39 REPLIES 39

If you see the reply from @Alex_Boom above, they have added a feature that fixes this for dropdowns. ComboBox appears to not have this feature but leaving Default blank and DefaultSelectedItems as [] has the same effect.

 

 

FYI though, what you are attempting to do is actually what I ended up doing before the feature, via ClearCollect.

Example:

Screen.OnVisible = ClearCollect(FilteredWithBlanks,{ITEM:""},Filter([Table], ITEM = VAR).ITEM)
Dropdown.Items = FilteredWithBlanks
Dropdown.Default = ""

No, it is definitely a bad solution. Because the user can submit/patch that default blank value (or default "Select an Option" value for example) into the database. 
You can use a combobox instead, if you use the onchange attribute carefully 🙂

 

José

Hey @Shanescows ! I've been watching your videos on YouTube. It helped me a lot and still helps me as of now!

Thank you for the continuous help to the community.

 

Cheers!

The old property "AllowUnsetValue" has been renamed to "AllowEmptySelection"

On Dropdown-Cards you can set this "AllowEmptySelection" property to value "true" and the Default-Property to "" then you will have a blank default value in the Dropdowns. For all FormModes, of course

It makes sense to set this Default-Blank only to FormMode.New otherwise each edit will update with blanks:

 

If(SharePointForm1.Mode=FormMode.New, "", Parent.Default)

 

Not available for Combo Boxes

Anonymous
Not applicable

Has anyone experienced the issue that after AllowingEmptySelection in a dropdown - inspite of setting Defaults for New Form to be "" and the rest modes to Parent.Default,  the field still comes out as empty when in view or edit mode???  😕

 @Anonymous Hey Lou!

 

I know it's been a few weeks late, but were you able to solve your issue? Because I'm thinking this might be because there might be something wrong on your "Update" field for the control.

Anonymous
Not applicable

Hey @fpc-kdrosario !

thanks for the follow-up.  I will need to go back to that and check.  I ended up just leaving it without the empty field just for the testing phase.  Once I get back to it with the feedback from folks I'll double check the 'Update" field and report back.

 

Thanks for the thoughts,

Lou

PDeng
New Member

Se não puder criar um item em sua lista em branco, basta preencher com valor "true" a opção AllowEmptySelection, do seu dropbox, em seguida preencher a opção Default do seu dropbox com o seguinte conteúdo "".

 

 

 

planetparker
Frequent Visitor

My solution to this is to dynamically add a blank or "<choose one>" option to the dropdown control which is added at runtime, instead of having to add a bogus value to my source list or table.

To do this, I add an entry to my App OnStart which puts the source data of the dropdown list into a collection, and then immediately add an additional row to that collection to serve as the default value.

So for example:
ClearCollect(colMyDropDownList, 'Source List Data');
Collect(colMyDropDownList,{Title: "<choose one...>"});

Then in my dropdown control, I set this as the "Items" property:
Sort(colMyDropDownList,Title,SortOrder.Ascending).Title

Then you can add additional logic to your app, for example to hide/disable other controls if the dropdown.selected.value is still equal to "<choose one...>" or not.

Hope that helps.


 

WoLe98
Frequent Visitor

It is also possible to use a Blank() value in the allowed values as first item, i.e.: [Blank(), "firstitem", "seconditem", "thirdItem"]. In the datasource it will be stored as NULL.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,463)