web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Combo box in edit forms
Power Apps
Answered

Combo box in edit forms

(0) ShareShare
ReportReport
Posted on by

Hi,

 

I couldn't find the answer to this but i'm hoping it's something simple!

 

I want to use combo boxes for data entry in some edit forms. This is because they are drawing from a long list of options in SharePoint and I would like users to be able to type into them rather than having to scroll through over 100 entries in a drop down control. I have been using drop downs and have them set up so that they default to a "-" on a NewForm, but show the current value when in EditForm, which I would like to preserve.

 

The issue that I am having is that when I add a combo box to the data card I can't get the card's update property to recognise the combo box.selected.value, not can I get the combo box to accept the default of "If(StudentDetailsFrm.Mode=FormMode.New,"-",ThisItem.Programme)"

 

I have tried creating a 'Choice' field type from Sharepoint (as this has the funtionality that I want in PowerApps) but I can't seem to recreate it myself.

 

Any suggestions would be appreciated

 

UPDATE- I have marked a post as the solution, however the whole thread contibuted towards it.

Categories:
I have the same question (0)
  • CarlosFigueira Profile Picture
    on at

    If you have a Choice field in SharePoint, then the default value needs to be an object, not a string (that's how choice columns are stored in SharePoint). The blog post at https://powerapps.microsoft.com/en-us/blog/default-values-for-complex-sharepoint-types/ has more details about this scenario, but for your specific case, you can use this expression in the DefaultSelectedItems property of the combo box control (the control itself, not the card that contains it):

    If(
     StudentDetailsFrm.Mode = FormMode.New,
     { Value: "-" },
     Parent.Default)
  • SG-19021613-0 Profile Picture
    on at

    Hi,

     

    Thanks for the reply. I haven't actually used a choice field in the SharePoint list, it is a single line text field- I knew that the choice field generated a combo-box style data card so I wanted to try and use it as a template to recreate it for my text field, with data values drawn from a seperate list (acting as a look up). I wasn't clear in my original post, apologies.

     

    I have tried the formula that you suggested, but this returns a invalid argument error (due to the lack of clarity mentioned above?)

  • v-xida-msft Profile Picture
    on at

    Hi @SamGibbs,

    Do you want to provide values for a Single line of text field using Combo box control within the Edit form?

    Based on the formula that you provided, I think there is something wrong with the formula that you provided within the DefaultSelectedItems property of the Combo box control.

    The DefaultSelectedItems property of the Combo box control is required to provided a record value, but the ThisItem.Programme formula (within the formula that you provided) would return a text value.

    I have made a test on my side, please take a try with the following workaround:17.JPG

    Note: The Dept column is a Single line of text type column. Within Dept Data card, I remove the original TextInput control, and add a Combo box control to instead of it.

    Set the Items property of the Combo box control to following formula:

     

    Choices('20181003_case3'.Department)

    Note: The '20181003_case3' represents the separated list which the Dept column pulls data from.

    Set the DefaultSelectedItems property of the Combo box control to following formula:

     

     

    If(
     EditForm1.Mode = FormMode.New,
     {
     '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
     Value: "-" 
     },
     {
     '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
     Value:Parent.Default
     }
    )

    On your side, you should type the following formula:

     

     

    If(
     StudentDetailsFrm.Mode = FormMode.New,
     {
     '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
     Value: "-" 
     },
     {  /* <-- Modify here, type a record value rather than a Text value */
     '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
     Value: ThisItem.Programme
      }
    )

    The GIF screenshot as below:Test1.gif

     

     

    Best regards,

    Kris

     

  • SG-19021613-0 Profile Picture
    on at

    Hi @v-xida-msft,

     

    Thank you for looking into this. The formula that you provided works for setting a default on a new form, or picking up the exisiting value when editing.

     

    Formula in DefaultSelectedItems = If(Form2.Mode = FormMode.New,{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",Value: "-" },{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",Value: ThisItem.Department})

     

    I couldn't set the combo box items property to Choices('MasterDeptList'.Title) which is the list I want to take the options from. The formula checked says that it has some invalid arguments. However just having Items= MasterDeptList.Title seems to work anyway?

     

    The main issue now is that the data card Update property has the error "Name isn't valid. This identifier isnt recognised." Currently DataCard Update= ComboBox1.Selected.Value. What am I missing here as currently the form will not submit.

     

    Thanks again

    Sam

  • v-xida-msft Profile Picture
    on at

    Hi @SamGibbs,

    Could you please share more details about the error message on your side?

    Please check if there is a column called Title within your SP list data source (MastreDeptList). Also please check if you have renamed the Title column into another name.

    If the issue still exists, please take a try to re-create your app, then check if the issue is solved.

     

    Best regards,

    Kris

     

  • SG-19021613-0 Profile Picture
    on at

    Hi,

     

    Do you mean the error message relating to the DataCard Update property?

    Capture.JPG

     

    I have been using MasterDeptList.Title as a reference in other apps and it has always worked (including in dropdown controls). the combo box control is happy with Item= MasterDeptList.Title, but won't accept Choices in the formula.

  • SG-19021613-0 Profile Picture
    on at

    Hi @v-xida-msft

     

    I have built a new app to try and test this out. I still can't get it to work.

     

    I have realised that the use of Choices in the items property of the combo box, will only work if it is linked to a choice field in sharepoint. I am using a single line of text field as a look up.

     

    However, I have got it to the point where a new form defaults to a '-', edit form returns the entry already in the record. I can use the combo box to search and select a desired value, so it's nearly there.

     

    The last issue is getting the datacard Update property (currently = ComboBox1.Selected.Value) to accept the combo box defined record. I have included the picture of this error. I have tried making it Update=ComboBox1.Selected but then it is expecting text.error combo.JPG

     

     

  • Verified answer
    v-xida-msft Profile Picture
    on at

    Hi @SamGibbs,

    Do you add the Combo box control within the Department data card rather than outside the Departemnt data card?

    Please take a try with the following workaround:

    Set the Items property of the Combo box control to following formula:

    MasterDeptList.Title

    Set the Update property of the Department data card to following formula:

    ComboBox1.Selected.Title

    then check if the issue is solved.

     

    Best regards,

    Kris

  • SG-19021613-0 Profile Picture
    on at

    Hi @v-xida-msft

     

    I was adding it into the data card- making the update = ComboBox1.Selected.Title has now resolved the issue.

     

    Thank you for your help with this one; it had been bugging me for weeks!

  • shsulai Profile Picture
    4 on at

    Thank you, this is really helpful.

     

    The new and view forms work perfectly. The only problem that I seem to have is, even though, the correct value is displayed in edit form, I have to reselect the item in the combobox for me to save (required field validation kicks in). Any thoughts on how I can solve this?

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard