Hey guys, I need to implement the "Save as Draft" feature in the registration form.I have two buttons "submit" and "draft save". On clicking the "draft save" button,the data needs to be saved as a draft.But initially, the user is not yet created. How do I implement this draft save??
Given the limited information, I recommend introducing a new attribute, perhaps named status, that serves as a foreign key referencing a static entity named FormSaveStatus. This static entity should contain two records: "Draft" and "Submit."
When a user clicks on "Save Draft," the system saves the information while setting the status attribute to correspond to the "Draft" record in the FormSaveStatus entity. Similarly, when the user opts to submit the form, the system saves the information with the status attribute set to the "Submit" record.
This approach allows for clear differentiation between draft and submitted forms. The FormSaveStatus table acts as a lookup for the status of each registration entry, providing a streamlined way to manage the form's lifecycle.
Hope this helps!
Hi Shamith, I hope you are well.
To save the draft, you will need to save some information that identifies the user who is filling out the form, there is no way around that.
So if the user is not logged in (e.g. a registration screen):
- Create a cookie and in the OnInitialize on this screen you generate a token that will be stored in this cookie.
- This way, if the cookie is empty, it will create a token and store it in that cookie.
- The next time that same user enters this screen, the cookie will be filled so you will know whether the user has already been there or not.
Now how to save the draft:
- Create a table (entity) with the fields you want to save.
- In this same table you place an attribute to store the cookie token
- This way you saved the form items and referenced the token of that user who is on the screen.
To retrieve the draft when the user reaches the form screen
- Just do a get on the table, looking for the cookie value
- If you find the form, it will be filled with the information
- If it is not found, the form will be blank (and a new token will be filled in the cookie).
If you need more details, let me know, I think you can do the steps with images.
Until,
Hi @Shamith B Kulal,
The way in which I have previously implemented such a feature was with the help of Email and OTP.
So basically, we would ask the user to fill out the form, and if they decide to Save as Draft, then we would ask the user to enter their email ID and then Save as Draft. When they come back later and want to open their draft application, they will need to enter their Email ID, we will send an OTP to their email, once they validate that, we will restore their data whatever they have filled. This way, you do not need to save any User information to recover their draft other than their Email to validate and open their application.
You might need to have some Boolean parameters to identify whether what data is actual and what is draft and might also want to save information about where they were in the application when they Saved as draft, so that we can open the exact screen where they left, just to improve User experience.
These all are suggestions as your use-case and business implementation might be totally different than this.
Regards,
Prakhar Sharma
If you have any functionality like below:
1st need to save form as Draft and then use the same info for submission in later case,
Then, I will suggest to save the Draft as is in Database and add one attribute with type Boolean say IsDraft, Mark it as True when we click on Draft and on submission make the flag as False. So even if the user is not created yet you can save this info with name of user or some Unique key to identify the User in later case and do the required assignment.
Hii
Kindly refer this video I am sharing link https://www.youtube.com/watch?v=FsBQvA_NIXY
Thanks
Hi Shamith B Kulal ,
For "Save as Draft" feature you can also this link.
https://www.youtube.com/watch?v=FsBQvA_NIXY
Hope this helps.
Thanks,
Narendra Tiwari