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.
![Display Variable]()
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.
![New Button]()
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.
![Design]()
Step 4. Set Variable for Save as Draft, which will say to set controls as optional.
![Set Variable]()
Step 5. Set Variable for Submit which will say to set controls mandatory.
![Submit]()
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.
![Scenario]()
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.
![Property Formula]()
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.
![OnSuccess]()
![Trre view]()
Output
![Output]()
![Demo List]()
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.