Skip to main content

Notifications

Community site session details

Community site session details

Session Id : lx1umnnI1pUnTZ8wBxixNp
Power Apps - Building Power Apps
Answered

Required fields in gallery not working on app start

Like (0) ShareShare
ReportReport
Posted on 28 Aug 2023 13:38:22 by

Hello everybody, I have a gallery in Power Apps that serves as a checklist and I have all the questions on them as required fields that need to be answered for the checklist to be submitted, the problem is that when the app first runs and it goes to the checklist, if they hit submit it gets uploaded (even with the required field), however when they DO submit it, then the required fields kick in and start working, how do I make it so that it starts from the first try?

Categories:
  • Angel5 Profile Picture
    on 30 Aug 2023 at 15:28:03
    Re: Required fields in gallery not working on app start

    Just did!

  • SpongYe Profile Picture
    5,580 Super User 2025 Season 1 on 30 Aug 2023 at 15:25:57
    Re: Required fields in gallery not working on app start

    Please post a new question for this one as it related to a new problem and I will take a look.

    If you like my responses, please give it a Thumbs Up.

  • Angel5 Profile Picture
    on 30 Aug 2023 at 15:23:09
    Re: Required fields in gallery not working on app start

    Thank you, this worked! Hopefully you can help me a little on the next problem that I have:

    If(
     'Review Purpose'.Selected.Value="Review purpose", Notify("Select the Review Purpose."), 
     'Project Site Box'.Text="", Notify("Input the Project Site."), 
     InputDrawing.Text="", Notify("Input the Drawing Numbers."),
     'Project Number'.Text="", Notify("Input the Project Number."),
     !IsEmpty(Filter('OneLine Gal'.AllItems, Answers.Selected.Value="")), Notify("Enter an answer for all questions."),
     !IsEmpty(Filter('OneLine Gal'.AllItems, Answers.Selected.Value="Passed with comments")), Notify("Enter comment on answers Passed with comments."),
     !IsEmpty(Filter('OneLine Gal'.AllItems, Answers.Selected.Value="Not Passed")), Notify("Enter comment on answers Not passed."),
     Set(LabelVisible,true); 
    
    ForAll('OneLine Gal'.AllItems, Patch('Power App Data Store', Defaults('Power App Data Store'), //The for all selects all the items in the gallery, the patch function is to upload the fiels to their columns
    {
    'Unique ID':'Project Number'.Text & "-" & InputDrawing.Text & "-" & DocTitleBox.Text, 
    Title:Label3.Text, 
    'Project Site':'Project Site Box'.Text,
    'Project Number':'Project Number'.Text,
    'Drawing#':InputDrawing.Text,
    'Review Purpose': 'Review Purpose'.Selected.Value,
    'Document Title':DocTitleBox.Text,
    'Document Number':DocNumberBox.Text,
    Department:DepartmentBox.Text,
    'Question Number':'Question Numbers'.Text,
    'Checklist Questions':'Checklist Questions'.Text,
    Answers:Answers.Selected.Value,
    Comments:Comments.Text,
    'Additional Comments':'Additional Comments'.Text,
    Score: If(Answers.Selected.Value="Passed","3",Answers.Selected.Value="Passed with comments","1",Answers.Selected.Value="Not passed","0",Answers.Selected.Value="N/A","")
    }
     
    ));
    Office365Outlook.SendEmailV2(
     User().Email,
     "One Line Checklist", //Subject of the email
     "PDF Generated by Power App", //Content of the email 
     {
     Attachments: Table(
     {
     Name: "OneLineCheck.pdf", //Name of the pdf generated
     ContentBytes: PDF( //Calls the pdf Function
     'Container 1', 
     {ExpandContainers: true} 
     )
     }
     )
     }
    );
     Set(ProcessCompleted,true); 
     Set(LabelVisible,false)
    ) 

     

    For when they pick Not passed or Passed with comments on the dropdown, I want them to fill the comment box next to the question, so the notification shouldn't appear if the filled the comment box next to the question with anything other than blank, hopefully you can help me on this, thank you!

  • Verified answer
    SpongYe Profile Picture
    5,580 Super User 2025 Season 1 on 30 Aug 2023 at 14:03:44
    Re: Required fields in gallery not working on app start

    @Angel5 Thank you for your response.


    Based on the code you need to change the setup:

     

    If(
     'Review Purpose'.Selected.Value="Review purpose", Notify("Select the Review Purpose."), 
     'Project Site Box'.Text="", Notify("Select the Project Site."), 
     InputDrawing.Text="", Notify("Input the Drawing Numbers."),
     'Project Number'.Text="", Notify("Input the Project Number."),
     !IsEmpty(Filter('OneLine Gal'.AllItems, Answers.Selected.Value="")), Notify("Enter an answer for all questions."), 
     Set(LabelVisible,true); 
    
    ForAll('OneLine Gal'.AllItems, Patch('Power App Data Store', Defaults('Power App Data Store'), //The for all selects all the items in the gallery, the patch function is to upload the fiels to their columns
    {
    'Unique ID':'Project Number'.Text & "-" & InputDrawing.Text & "-" & DocTitleBox.Text, 
    Title:Label3.Text, 
    'Project Site':'Project Site Box'.Text,
    'Project Number':'Project Number'.Text,
    'Drawing#':InputDrawing.Text,
    'Review Purpose': 'Review Purpose'.Selected.Value,
    'Document Title':DocTitleBox.Text,
    'Document Number':DocNumberBox.Text,
    Department:DepartmentBox.Text,
    'Question Number':'Question Numbers'.Text,
    'Checklist Questions':'Checklist Questions'.Text,
    Answers:Answers.Selected.Value,
    Comments:Comments.Text,
    'Additional Comments':'Additional Comments'.Text,
    Score: If(Answers.Selected.Value="Passed","3",Answers.Selected.Value="Passed with comments","2",Answers.Selected.Value="Not passed","1",Answers.Selected.Value="N/A","0")
    }
     
    ));
    Office365Outlook.SendEmailV2(
     User().Email,
     "One Line Checklist", //Subject of the email
     "PDF Generated by Power App", //Content of the email 
     {
     Attachments: Table(
     {
     Name: "OneLineCheck.pdf", //Name of the pdf generated
     ContentBytes: PDF( //Calls the pdf Function
     'Container 1', 
     {ExpandContainers: true} 
     )
     }
     )
     }
    );
     Set(ProcessCompleted,true); 
     Set(LabelVisible,false)
    ) 

     

    You need one If then the last else will execute the Submit if all the checks are false. 

  • Angel5 Profile Picture
    on 30 Aug 2023 at 13:24:59
    Re: Required fields in gallery not working on app start

    Yeah but I want the gallery to be submitted when all these checks are NOT met, since it would mean that the user put something in the required fields, so when these fields are filled, then the submit happens, here is my code on how I achieved this: 

    If(If('Review Purpose'.Selected.Value="Review purpose",Notify("Select the Review Purpose."), 
    'Project Site Box'.Text="",Notify("Select the Project Site."), 
    InputDrawing.Text="",Notify("Input the Drawing Numbers."),
    'Project Number'.Text="",Notify("Input the Project Number."),
    !IsEmpty(Filter('OneLine Gal'.AllItems, Answers.Selected.Value="")), Notify("Enter an answer for all questions."))=ProcessCompleted=false, 
    Set(LabelVisible,true); 
    
    ForAll('OneLine Gal'.AllItems, Patch('Power App Data Store', Defaults('Power App Data Store'), //The for all selects all the items in the gallery, the patch function is to upload the fiels to their columns
    {
    'Unique ID':'Project Number'.Text & "-" & InputDrawing.Text & "-" & DocTitleBox.Text, 
    Title:Label3.Text, 
    'Project Site':'Project Site Box'.Text,
    'Project Number':'Project Number'.Text,
    'Drawing#':InputDrawing.Text,
    'Review Purpose': 'Review Purpose'.Selected.Value,
    'Document Title':DocTitleBox.Text,
    'Document Number':DocNumberBox.Text,
    Department:DepartmentBox.Text,
    'Question Number':'Question Numbers'.Text,
    'Checklist Questions':'Checklist Questions'.Text,
    Answers:Answers.Selected.Value,
    Comments:Comments.Text,
    'Additional Comments':'Additional Comments'.Text,
    Score: If(Answers.Selected.Value="Passed","3",Answers.Selected.Value="Passed with comments","2",Answers.Selected.Value="Not passed","1",Answers.Selected.Value="N/A","0")
    }
     
    ));
    Office365Outlook.SendEmailV2(
     User().Email,
     "One Line Checklist", //Subject of the email
     "PDF Generated by Power App", //Content of the email 
     {
     Attachments: Table(
     {
     Name: "OneLineCheck.pdf", //Name of the pdf generated
     ContentBytes: PDF( //Calls the pdf Function
     'Container 1', 
     {ExpandContainers: true} 
     )
     }
     )
     }
    );
    Set(ProcessCompleted,true); 
    Set(LabelVisible,false)) 

    This works, but it only works when the user hits the submit button for the first time since the app ran, it defeats the whole purpose of these being required fields if on their first run of the app they're able to hit submit without any fields filled, please let me know for an answer on how to get it going on app start!

  • SpongYe Profile Picture
    5,580 Super User 2025 Season 1 on 29 Aug 2023 at 00:25:15
    Re: Required fields in gallery not working on app start

    Hello @Angel5 ,

     

    Is the order of your code in your Submit button set in the correct sequence?

    Based on your previous post and the information I have now it would like this:

     

     

    If(
    	ReviewpurposeDropdown_13.Selected.Value="Review purpose",
    		Notify("Select the Review Purpose."),
    	TextInput1_3.Text="",
    		Notify("Select the Project Site."),
    	InputDrawing_13.Text="",
    		Notify("Input the Drawing Numbers."),
    	TextInput1_1.Text="",
    		Notify("Input the Project Number."),
    	!IsEmpty(Filter(Gallery.AllItems, GalleryDropdown1_2.Selected.Value="")),
    		Notify("Enter an answer for all questions."),
     SubmitForm(<FormName>)
    )

     

     

    If all checks have been performed then only the Submit will be executed.

     

    Please let me know if this worked for you.


    ------------------------------------------------------------------------------------------------------------------------------
    If I have answered your question, please mark your post as Solved. Remember, you can accept more than one post as a solution.

    If you like my response, please give it a Thumbs Up.

  • Angel5 Profile Picture
    on 28 Aug 2023 at 21:11:57
    Re: Required fields in gallery not working on app start

    Still haven't found the solution, please let me know!

     

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,776 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,093 Most Valuable Professional

Leaderboard
Loading complete