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 / Approach for form vali...
Power Apps
Unanswered

Approach for form validation dependent on status

(0) ShareShare
ReportReport
Posted on by 198

Hi All,

I am looking for a solution to this problem:

A user needs fo fill in a form with a lot of fields (>20) all of them are required in the process which follows after submitting the form. I want to make it possible to submit the data in 'concept mode' which means that in this mode, none of the fields are required, so the user can fill in the form gradually and save data.

But I want to make sure that when the user submits the form when he/she thinks everything is filled in ('final' mode), the required fields are validated so all have a value. The data source is a SharePoint list.

 

I made the required property for all fields dependent of a status field which is manipulated using Patch. Sadly this approach does not work reliable. I use the on failure and on success events of the form in order to determine if required fields are filled in when in 'final' mode, the patched value for status is rolled back, i.e. it gets the previous value. It is difficult to explain I know...

 I think this behavior is perhaps related to SharePoint but I have not tested it with a more suited data source like SQL server.

 

But perhaps my approach to this problem is not right, so I would like to know if somebody has found a solution for this use case?

Categories:
I have the same question (0)
  • Jeff_Thorpe Profile Picture
    6,085 Super User 2024 Season 1 on at

    Here is one way to it. All the columns in the SharePoint list need to be not required. In the PowerApps Form all the DataCards related to the fields that you want conditionally required need to have the Required property changed to look at the StatusMode (Concept/Final).  I am assuming the status mode is a choice field on the SharePoint list.

     

    Example: DataCard > Required: If(StatusModeDataCardValue.Selected.Value = "Final", true, false)

     

    Then you should be able to use the SubmitForm() to save the changes to SharePoint. If the Status Mode is equal to Final then the Form will throw an error if all the required fields aren't filled out. If the status mode isn't equal to Final then it will allow you to save the data without the fields being required.

  • BartSchaap Profile Picture
    198 on at

     

    Hi  @Jeff_Thorpe 

    Thank you for this answer, it is like the approach I choose. Some additional info to make my use case more clear:

     

    I have 2 buttons in the edit screen: btnSaveAsConcept and btnSaveAsFinal.

    When a user presses btnSaveAsConcept I use first Patch to update the status to 'Concept' and then submit form

    When a user presses btnSaveAsFinal I use first Patch to update the status to 'Final' and then submit form

    The required property for the fields is linked to this status as you describe. 

    The OnSuccess event of the form : Back() this navigates to the gallery from which the edit screen is reached.

     

    The problem is that when a user presses SaveAsFinal when one or more required field is not filled in and then decides to press SaveAsConcept, the form is submitted but in the gallery (and in SharePoint) the status is final and not concept as it should be in this case. The strange thing is that in the edit screen it is visible that the status is concept as you would expect. It seems that the status is reverted to final when navigating to the gallery. Any thoughts on this?

    Best regards,

    Bart

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 765 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 272

Last 30 days Overall leaderboard