cofi

cofi

  • Docs
  • Form Demos
  • Components Demos
  • Layout Demos
  • Editor
  • GitHub

›Form Class

Getting started

  • Introduction

Form Class

  • Installation
  • Overview
  • Arguments
  • Id
  • Data
  • Fields
  • Path
  • Component
  • Formatter & Parser
  • Dependencies
  • Required
  • Validators
  • Exclude Term
  • Disable Term
  • Require Term
  • Dependencies Change
  • Context
  • Dirty
  • Invalid
  • Errors
  • Processing
  • Pending Actions
  • Hooks
  • Term
  • Log
  • Error Codes
  • Actions
  • Definition Shorthand

Advanced Usages

  • Grid Usage
  • Form Persistency
  • Undo & Redo
  • Replay Actions
  • Track Actions
  • Server Validation
  • Entity Templates
  • Folder Structure

React Form

  • Installation
  • Overview
  • Form
  • Field
  • Components
  • Layout
  • Demos

Tools

  • Editor
  • DevTools

More Info

  • Test Cofi
  • Packages
  • Why Cofi?
  • Technologies
  • Videos
  • Channels

Contribute

  • Code of Conduct
  • Contributing Guide
  • Contributors

Dirty

Form / Field dirty flags are calculate on each relevant action such as init, change value and change data.

This does not need to be passed by default in the initial form model json. You can pass it in the initial form model json, if you are currently loading a form model from persist model (i.e you saved the form model before user did page reload - and want to reload the form with the exact same model state that it was before the refresh)

Field Dirty

model.fields.someField.dirty - boolean. Flag that reflects if the field is dirty. A field is dirty when its value is different from the initialized data that the form initiated.

Note: Initialized data is the model.initializedData that was ready after init action done. It might not be equals to the initial data - that was passed to the form in the model, since init run also dependenciesChange handlers of fields that might change their value during init. Anyway you can always compare model.data to to the initial data - model.initialModel.data to know if data was changed from before init and not after init done.

Form Dirty

model.dirty - boolean. Flag that reflects if the form model is dirty. Form is dirty if at least one field is dirty. Excluded fields are not included in this calculation.

Example

Disable a save button when form model is not dirty (no need for un necessary calls to the server).

<Button disabled={!model.dirty}>Save</Button>
← ContextInvalid →
  • Field Dirty
  • Form Dirty
  • Example
cofi
Copyright © 2021 Verizon Media
DOCS
IntroductionForm ClassReact FormReact ComponentsReact Layout
DEMOS
React FormReact ComponentsReact Layout
CONTRIBUTING
Code Of ConductContributing GuideContributorsUsers
CHANNELS
StarGitHubStack OverflowMediumVideos