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

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

How to create custom module on Spryker for Backoffice?

Spread the love Creating a custom module in Spryker

How to Install Spryker Project with Docker on Local Machine

Spread the love Spryker is a flexible and scalable commerce

How to Add a Custom Tab to the Customer Order Detail Page in Magento 2

Spread the love Adding a custom tab to the Order Detail

Exception Handling in Java

Spread the love Introduction – Exception:An unwanted

How to add custom less file in Magento2

Spread the love Source files *.css included into layout

Spring Boot Microservices

Spread the love Microservices architecture has become

bluethinkinc Blogs