Skip to main content

Notifications

Community site session details

Community site session details

Session Id : PlM69LBSJ71yHLwEuO/ZkN
Power Apps - Building Power Apps
Suggested answer

Form Validation

Like (1) ShareShare
ReportReport
Posted on 24 Dec 2024 10:04:39 by 93
Is there a way of validating whether a form has data in all of its required fields in one go, rather than checking each field individually before submitting? I have a form with over 50 fields and I'd prefer not to have to write out that code manually.
 
I have a weird error where I try to submit a form but an error is thrown suggesting there is an empty field that needs filled but I can't work out which one it is. I have this code a the moment to try and help show me the column but is failing to pickup the column name - 
 
Notify(Concat(Errors("Datasource"),Column&": "&Message),NotificationType.Error)
 
 
Any ideas of why this is not working or how to validate the full form before submission?
 
Categories:
  • Suggested answer
    toomuchcoffee1122 Profile Picture
    93 on 02 Jan 2025 at 16:37:20
    Form Validation
    I have implemented a bit of a workaround to this issue - the fields that are of type LookUp are now set to View Display Mode, and it appears to have solved the issue. The form was requiring the user to click onto each tab to "load" the data in the form (I think), and setting the fields to View display mode has eliminated this problem. The data was in the form but it wasn't being loaded.

    It's not an ideal solution by any means but it works. I am considering raising this as a bug to Microsoft.
  • WarrenBelz Profile Picture
    146,798 Most Valuable Professional on 02 Jan 2025 at 11:32:33
    Form Validation
    You have a bit of hard-coding to do (check each one and then generate a message) or make the built-in error message in the data cards visible if the control is blank and a variable is set to true when you try to save.
     
    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn    Buy me a coffee
  • toomuchcoffee1122 Profile Picture
    93 on 02 Jan 2025 at 10:05:32
    Form Validation
    @WarrenBelz this sort of works but I am still unable to find out which specific field is not validating correctly, which is the main crux of the problem.
  • WarrenBelz Profile Picture
    146,798 Most Valuable Professional on 31 Dec 2024 at 22:57:33
    Form Validation
     
    A quick follow-up to see if you received the answer you were looking for or if you need further assistance.

    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn    Buy me a coffee
  • Mike2500 Profile Picture
    1,247 Super User 2024 Season 1 on 24 Dec 2024 at 13:00:20
    Form Validation
    If you're using an editform, you can use the "Valid" property to check if everything in the form is valid. 

    From the help docs, here's code to enable the submit button only when the form is valid:
    SubmitButton.DisplayMode = If(IsBlank( Form.Error ) || Form.Valid, DisplayMode.Edit, DisplayMode.Disabled)
     
    Of course, this requires the fields to be set up with proper settings, such as whether they are required, so that the form knows what is or isn't valid. If you're getting errors after submit, perhaps the field in the data source is required, but perhaps the card in the form was unlocked and customlzed? Check the "required' property of each card to make sure that they match the settings in the data source. 
  • Suggested answer
    WarrenBelz Profile Picture
    146,798 Most Valuable Professional on 24 Dec 2024 at 12:40:43
    Form Validation
    The Valid test generally works
    If(
       YourFormName.Valid,
       SubmitForm(FormName),
       Notify( . . . . 
    )
     
    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    Buy me a coffee

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 > Power Apps - Building Power Apps

#1
MS.Ragavendar Profile Picture

MS.Ragavendar 20

#2
BCBuizer Profile Picture

BCBuizer 10 Super User 2025 Season 1

#2
LC-26081402-0 Profile Picture

LC-26081402-0 10

Overall leaderboard
Loading started