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

Custom API to Fetch Customer Data by Customer ID in Spryker

Spread the love Introduction In this blog post, we will

Creating a Custom Module for a Custom Frontend Page in Spryker

Spread the love To create a custom module for a custom

How to create custom module api get category list without access token in Spryker

Spread the love To create a custom API for fetching a

Creating a Custom Glue API in Spryker

Spread the love Spryker’s Glue API is a powerful tool

Get AI Generated 360-Degree View of Account Summary in Dynamics 365 Sales

Spread the love Navigating the demanding landscape of sales

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

bluethinkinc Blogs