Skip to content

Methods

cleanChanges

Clean changes (Not revert Values!). Rewrite changes If new values provided.

form.cleanChanges();
form.changes // {}

In the case of passing values, the changes will be equal to the keys of the passed value

form.change({
    username: "Jack",
    age: 23,
    sex: 'm'
})
form.changes // { usename: "Jack", age: 23, sex: "m" }
form.cleanChanges({
    username: true // Is not NEW value! Just cast for values
})
form.changes // { username: "Jack" }

cleanField

Method using for clear field. Don't set NULL. Remove field from values.

form.values // { username: "Jack", age: 23 }
form.cleanField('username')
form.values // { age: 23 }

cleanValues

Clears the current values. If a new value object was passed, sets it as the current one.

form.values // { username: "Jack", status: "free" }
form.cleanValues({ name: "Donald" });
form.values // { name: "Donald" }

getValues

Returns the form value. If field names were passed, it will return only their values

form.values // { username: "Jack", age: 23, sex: "m", status: "free" }
form.getValues() // { username: "Jack", age: 23, sex: "m", status: "free" }
form.getValues('username') // { username: "Jack" }
form.getValues('age', 'sex') // { age: 23, sex: "m" }

change

This method sets the values and marks them as changed.

function change(values: Values)

input

It is analogous to the change method, but has a different structure of passed values.

function input(name: string, v: any)

setValues

The main value setting function. In fact, all other functions use it internally. Passed Values will not completely overwrite those already in the form. There will be a stage of mixing values. Further, values will be broken down into simple components:

{
  "address.city.code": 1,
  "name": "Jenesius"
}

Will be split into:

{
  "address": {
    "city": {
      "code": 1
    }
  },
  "name": "Jenesius"
}

After that, new values will be passed to all dependent elements.

function setValues(values?: Values)

cleanChanges

It just clears the marked fields as changed. Does not return their values back!

function cleanValues(values?: Values)

save

form.save()

read

form.read()

validate

This function is used to validate the form. Returns true if the form and all of its children are valid, false otherwise.

form.validate()

depend

function depend(item: any)

getAssociatedDependencies

function getAssociatedDependencies(name: string)

Return possible dependencies by name. For example:

  • address: address, address.city, address.description
  • address.city:address, address.city

getDependenciesByName

function getDependenciesByName(name: string): any[]

getValueByName

function getValueByName(name: string)

disable

Block all fields (or passed by name).

function disable(name?: string)

enable

Unlock all fields (or passed by name).

function enable(name?: string)

getDisabledByName

function getDisabledByName(name: string)