cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Help with Checkbox Reset In SharePoint Form

Hi, All.  I've tried several posts and videos and I just can't get this to work:

 

I've created a default SharePoint list form in Power Apps, and changed the multi-select drop-downs to checkboxes within galleries.  It all works well, except when I click the New form button in SharePoint, the form doesn't clear the previous checkbox entries.

 

If possible, I'd like the entire form to reset when the New SharePoint form button is pressed.   Right now it does, except for the checkboxes.  

 

Here are my details (collection is colCategoryData):

 

  1. Checkbox:
    1. Text: ThisItem.Value
    2. OnCheck: Collect(colCategoryData, ThisItem)
    3. OnUncheck: Remove(colCategoryData, ThisItem)
    4. Default: ThisItem.Value in colCategoryData.Value
  2. Data Card:
    1. Default and Update: colCategoryData
  3. Gallery
    1. Items: Same as original multi-select drop-down

 

Anything beyond this that I've found (variables, OnVisible, Reset) doesn't work.

 

Please and thank you.  I'm pulling out what little hair I have left.  

11 REPLIES 11
Drrickryp
Super User
Super User

@Anonymous 

Did you put the gallery inside a card on the form?

Anonymous
Not applicable

Hi, Drrickryp. 

 

Yes. 

 

I followed Reza's vid, including info in the comments for SharePoint forms, and check boxes are still not clearing when a new form is opened.  

 

Everything else seems to work fine.

Drrickryp
Super User
Super User

Anonymous
Not applicable

Hi, @Drrickryp .

 

Thanks for the link, but it didn't help.  Opening a new form in SharePoint still retains the checkbox info of the last saved form.  I also notice that if you open a new form then cancel it, the checkboxes in previously saved forms are blanked out.   

 

Here's my process and code, taken from the video by @Reza as well as other sources such as the link you sent.

 

  1. Copy formula in Items property of the combo box
  2. Delete combo box from Datacard
  3. Insert gallery into Datacard (insert, then cut/paste)
  4. Insert a single Checkbox into the Gallery
  5. Paste the formula from step 1 into the Gallery Items property

Storing/removing SharePoint list values

  1. Checkbox
    1. Text property: ThisItem.Value
    2. OnCheck property: Collect(colCategoryData, ThisItem)
    3. OnUncheck property: Remove(colCategoryData, ThisItem)
    4. Default property: ThisItem.Value in colCategoryData.Value
  2. Data Card:
    1. Change Default and Update property to colCategoryData
  3. FormScreen1:

OnVisible:

Clear(colCategoryData);

If(SharePointForm1.Mode <> FormMode.New,

(

Collect(colCategoryData,

LookUp(SPLISTNAME,ID=SharePointIntegration.SelectedListItemID,SPCOLUMNNAME)

)

Drrickryp
Super User
Super User

@Anonymous 

It appears to me that the checkboxes are dependent on  colCategoryData.  If the collection is cleared, then the checkboxes should be returned to their default state.

Anonymous
Not applicable

@Drrickryp 

 

Are you saying this should be working as written, or that it needs changes?

 

Phil

Drrickryp
Super User
Super User

@Anonymous 

When you open a Form in New mode, Clear(colCategoryData).  If the gallery depends on that collection, it will not retain old information. 

Anonymous
Not applicable

@Drrickryp 

 

Sorry if I'm being dense, but how would I make this happen?

Drrickryp
Super User
Super User

@Anonymous 

Since I don't use Integrated SharePoint forms, I am not familiar with the specific commands but there must a button that you push to open the form in New mode,  It would have NewForm(Form...) as a command.  If you find it add

NewForm(Form1);Clear(colCategoryData)  Then when you navigate to the form, the Gallery should be reset.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

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