Introduction
Any app's "save as draft" feature saves a tonne of data. Longer forms are a very necessary feature. Any user can save a draft version of a form after filling out half of it. The form can be picked up later at the location where it was placed.
Scenario
The ability to save a draft and preserve form properties will be visible to us. Additionally, we'll demonstrate how to make fields compulsory by default. There will be just two normal buttons added in the form and the formula will be different which will make the functionality for both buttons different.
Objective
This requirement's goal is quite difficult because it frequently calls for saving the form halfway through. Thus, the ability to save as a draft is useful in daily situations.
Step 1. From Gallery, users can navigate to the form as per the requirement.
We'll be concentrating on button and form functionality in this tutorial. I created a gallery to display variable values in terms of necessary validation. Where it navigates is visible when we click an arrow.
Step 2. Create a New Button named New Button and its OnSelect property.
Our list structure could be of any type. We shall be seeing only button features and form functionalities. So, here we shall watch on the button to open a new form on what code should be written.
Step 3. Create a New Form with two or three buttons.
In the form design, we will see button functionality. The form details will be seen later.
Step 4. Set Variable for Save as Draft, which will say to set controls as optional.
Step 5. Set Variable for Submit which will say to set controls mandatory.
Step 6. Make a few fields mandatory for all the scenarios.
Fields that will be mandatory in all scenarios will be set as true by default. This avoids empty field entries in the list.
Step 7. Set the Required property formula.
Set a required property on condition for those fields that need to be validated and made mandatory or optional depending upon saving as draft or submission.
Step 8. OnSuccess property of Form to navigate depending upon the button value.
This means if it’s submitted it will go to another screen. If it’s saved as a draft it will go to another screen.
Output
Conclusion
When we click the "save as draft" button in the example above, the form is saved without the field values filled in because they are optional. All of the relevant columns must be filled in before clicking the save button.