What is data persistor

Blog
Spread the love

In this blog, we’ll learn what is data persistor and how to use it. When we fill out a form and something goes wrong in it, then the whole form is reloaded and the data gets erased. It’s very difficult to enter all data one by one. Data persistor will solve this problem. It’s just a class that stores data on the current user session. You can set, get, and clear data from the session.

Step 1- Add layout file with argument( form_index_index.xml)

Create layout file in app/codeBluethink/Customform/view/frontend/layout.

In your layout file, you need to add argument as shown below:

Step2 – Now we need to get data of user.

We need entered data of user to display on text field.

Create UserDataProvider.php in app/code/Bluethink/Customform/ViewModel folder.

Now we have customer data 🙂

Step 3- We create function required by ViewModel UserDataProvider

Create helper file Data.php in app/code/Bluethink/Customform/Helper folder.

Step 4- Let’s Call ViewModel on the Form

Create save.php in Controller/Index folder.

Step 5 – We need to call data persistor on the controller

Please comment is you have any query

bluethinkinc_blog

bluethinkinc_blog

2022-12-22

1

One Reply to “What is data persistor”

  • Avatar
    Shubham Singh

    Nice blog

    2022-12-22 at 10:27 pm Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Find More Blogs

Enhancing Productivity with Dynamics 365: The Power of Session Restore

Spread the love Enhancing Productivity with Dynamics 365:

Salesforce Admin

Spread the love In our last blog, we discussed common

Unlocking AI with Spring Boot: Real-World Use Cases and Solutions

Spread the love Artificial Intelligence (AI) has moved from

Enhancing Performance with Reactive Java: A Beginner-Friendly Guide

Spread the love In today’s fast-paced software

Integrating Azure Function with Dynamics 365

Spread the love Signup on azure portal and make sure to

How to Create a Power Apps Component Framework (PCF) with React

Spread the love If youʼve been looking to supercharge your

Customize lead qualification for a seamless experience

Spread the love When the 2024 Release Wave 2 was launched,

Create a Custom Console Command in Spryker

Spread the love In Spryker, developers can create custom

SALESFORCE

Spread the love Salesforce is a cloud-based software

CRUD Operation in Spryker Backoffice with a Custom Module

Spread the love Spryker is a highly flexible and modular

bluethinkinc Blogs