Skip to content
This repository was archived by the owner on Aug 18, 2021. It is now read-only.

Control state of changing data

Gustavo Denis edited this page Oct 31, 2019 · 1 revision
Main > Using Liquid for building your application > Control state of changing data

Input components can be either controlled or uncontrolled. Liquid's Controlled components are managed by React through the value and onChange properties. When the user enters text into the input element, the registered onChange event handler is executed and the text entered is passed as an argument via an events object.

Take a look at related key concepts of Liquid
Business Logic Separation

Controlling state of input data in the front-end

To use this feature Liquid provides the class FormControlStateIn. When this class is extended, if the user try to close the view without submit the changes, a dialog box will show up to guarantee is the right decision.

So, first thing first, extend the FormControlStateIn class.

class CreateComponent extends FormControlState {

This class will check if any of the inputs have changed and if the changes have been submitted. If it has not been, react will keep the same state as in React, input controls do not update themselves, they update the state, and then the state triggers a re-render to update the input control.

##applightform

The name of the component been created and an attribute "true"

<controlstatedisabled - "true">
See how this is done in Liquid Hotel360 sample application.

Optimistic concurrency

In an optimistic concurrency model, a violation is considered to have occurred if, after a user receives a value from the database, another user modifies the value before the first user has attempted to modify it.

Idempotent commands

From a RESTful service standpoint, for an operation (or service call) to be idempotent, clients can make that same call repeatedly while producing the same result. Note that while idempotent operations produce the same result on the server (no side effects), the response itself may not be the same.

Clone this wiki locally