Form

Form is a component that presents a page section containing special elements called controls (check boxes, radio buttons, etc.). Ui-related form inherits from view.


Full code of the example in the picture

Initialization

To init the component you need to perform a simple procedure - call initialization code.

Initialization code or an object constructor, lets you create an object by using common declaration.

dhx.ui ({view:"form", 
...})

Parameters

In constructor you can specify the following parameters:

  • scroll - (boolean) defines whether a possibility to scroll will be enabled. The default value is 'false'.

Please note, form is a derived class, i.e. it inherits all the features of the base class (form → view).

dhx.ui({ 
        rows:[{
             view:"form", id:"leftbar", data:[
                                    { type:"button", id: "field_a", value: 'Save', align:"right", label:"Save" },
                                    { type:"calendar", id: "field_b", label: 'Date' }]
	     }]
        ...
});

Useful tips

  • You can set id (form inherits this parameter from the base class view) both for the whole form and for any of the controls.
  • For form configuring (defining form controls) you can use load (in case of external datasource) or parse (in case of internal datasource) methods.
    To set values to these items(controls) you can use one of the following methods:
    • loadValues - in case of external datasource (sets values to all form's items).
    • parseValues - in case of internal datasource (sets values to all form's items).
    • setValues - in case of object (sets hash of values to all form's items).

Related how-tos