cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jsharkey
Helper II
Helper II

User-added fields during list form completion

I am customizing a request form for a SharePoint list which will have at least one set of fields representing a person and their contact information:

  • Name
  • Phone Number
  • License Plate Number
  • Email

How can I design this form to allow the user to input more than one set of these fields? I'm imaging a button or icon "Add Person" which will duplicate the fields. All of the metadata for people need to be stored in a single row of the for list data purposes. 

 

Example:

  • Person1
    • Name
    • Phone
    • License
    • Email
  • Person2
    • Name
    • Phone
    • License
    • Email

How can I implement this. What is the best option for the data source?

1 ACCEPTED SOLUTION

Accepted Solutions
v-yutliu-msft
Community Support
Community Support

Hi @Jsharkey ,

Do you want to have multiple rows to update in a form?

I agree with @WarrenBelz , I'm afraid it's not supported to display multiple items in one form. One form could only display one item.

I suggest you use gallery to update.

I've made a similar test for your reference:

1)set the screen's OnVisible:

ClearCollect(listnum,{personnum:"Person1"})

2)set the add row button's OnSelect:

Collect(listnum,{personnum:"Person"&CountRows(listnum)+1})

3)insert a gallery to edit records

set the gallery's Items:

listnum

insert some controls inside the gallery to edit data

4)insert a submit button to update multiple records at one time, set the submit button's OnSelect:

ForAll(Gallery1.AllItems,
       Patch(listname,
             Defaults(listname),
             {Name:TextInput1.Text,
              Phone:TextInput2.Text,     
              License:TextInput3.Text,
              Email:TextInput4.Text,
              }
))
//use controls inside gallery to update , I use textinputs as example, you could also use other controls

691.gif

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7
WarrenBelz
Super User III
Super User III

Hi @Jsharkey ,'

A Form will only display one record at a time. You can create an Editable Gallery - here is a good video on the process.

 

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.

v-yutliu-msft
Community Support
Community Support

Hi @Jsharkey ,

Do you want to have multiple rows to update in a form?

I agree with @WarrenBelz , I'm afraid it's not supported to display multiple items in one form. One form could only display one item.

I suggest you use gallery to update.

I've made a similar test for your reference:

1)set the screen's OnVisible:

ClearCollect(listnum,{personnum:"Person1"})

2)set the add row button's OnSelect:

Collect(listnum,{personnum:"Person"&CountRows(listnum)+1})

3)insert a gallery to edit records

set the gallery's Items:

listnum

insert some controls inside the gallery to edit data

4)insert a submit button to update multiple records at one time, set the submit button's OnSelect:

ForAll(Gallery1.AllItems,
       Patch(listname,
             Defaults(listname),
             {Name:TextInput1.Text,
              Phone:TextInput2.Text,     
              License:TextInput3.Text,
              Email:TextInput4.Text,
              }
))
//use controls inside gallery to update , I use textinputs as example, you could also use other controls

691.gif

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Yes, I want the form to only update one list item. However, I want each Item to have the ability to have many persons related with it:

  • Item 1:
    • ID
    • created by 
    • persons: **gallery items**
  • Item 2:
    • ID
    • created by
    • person: **gallery items**

Can this data be stored in a field (column) of the list?

Hi @Jsharkey ,

The process described by @v-yutliu-msft is what I was referring to with the video tutorial.

Yes, you can store whatever you want in a list item - it is up to you how you design it.

 

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.

Hi @Jsharkey ,

Do you mean that you want to add people in one item and the gallery for person field is a nested gallery inside the gallery for the list?

If so, please notice that: it's not supported to put a form inside a gallery.

So you could only put a nested gallery inside the gallery to display the multiple person field.

I've made a similar test for your reference:

my list named: survey, my multiple person field named: peo

1)the gallery's Items:

survey

2)insert an add button inside the gallery, set its OnSelect:

Set(var,ThisItem.ID);ClearCollect(test4,ThisItem.peo);Patch(test4,Defaults(test4),{Email:""})

3)insert a cancel button inside the gallery, set its OnSelect:

Set(var,0)

4)insert a gallery inside the gallery to display and edit the multiple person field

set the nested gallery's Items:

If(var=ThisItem.ID,test4,ThisItem.peo)

5)insert a combo box, some labels inside the nested gallery

the combo box is used to edit/add person value, the labels are used to display Name,Phone,email. (License is not supported to display in powerapps)

the combo box's Items:

Choices(survey.peo)

the combo box's DefaultSelectedItems:

{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
        Claims:"i:0#.f|membership|" & ThisItem.Email,
    Department:"",
   DisplayName:ThisItem.DisplayName,
         Email:ThisItem.Email,
      JobTitle:"",
       Picture:""
   }

set the combo box not allow multiple value.

label1's Text:

ThisItem.DisplayName

label2's Text:

First(Office365Users.SearchUser({searchTerm:ThisItem.Email})).mobilePhone

//if you want to display phone number, you need to use office365 connector

6)the arrow button's OnSelect:

Clear(test3);ForAll(Gallery8.AllItems,Collect(test3,ComboBox6.Selected));Patch(survey,Gallery6.Selected,{peo:test3});Set(var,0)

//gallery8 is the nested gallery name, gallery 6 is the outside gallery name.

 

The app works like this:

The nested gallery will display the multiple person field value by default, without blank row. But you could edit the existing person value. click the ">" button will save.
if you click "+" button, you will add a row in the nested gallery, you could fill in new person, click ">" will save.

If you want to cancel adding new person, you just need to click "x".

 

6105.gif

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@Jsharkey ,

@v-yutliu-msft has described this in great detail - I will leave you with them unless you want further input from me,.

Thank you for the detailed explanation but I am not looking to implement a nested gallery.

 

I think you have done enough to answer the original question so I will open a new forum for my follow up question. Thank you.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (89,749)