Difference between revisions of "JSFormBaseModel"

From GeoMedia Smart Client
Jump to: navigation, search
(disable())
(enable())
Line 57: Line 57:
 
=== enable() ===
 
=== enable() ===
 
----
 
----
enables the form item (and all its sub-items), i.e. making it editable.
+
enables the form item (and all its sub-items), i.e. making it editable. {{sinceGMSC07}}
  
 
'''Examples'''
 
'''Examples'''

Revision as of 10:07, 22 November 2013

GMSC 2013/2014 Javascript API Overview Form Events Types Utility Functions client-side Validation Conditions Interaction with SmartClient Cookbook Cheatsheet
Form Models BaseModel FormModel TabModel GroupModel Field Models ActionModel


Abstract Base Class that provides common methods and properties for FormModel, TabModel, GroupModel FieldModel, and ActionModel

Methods

show()


shows the form item (and all its sub-items) GMSC 07

Examples

show the form field 'TEST' in the current form

IG.form.getItemById('TEST').show();

hide()


hides the form item (and all its sub-items) GMSC 07

Examples

hide the form field 'TEST' in the current form

IG.form.getItemById('TEST').hide();

toggle()


toggles the form item (and all its sub-items), i.e. switch its state between hidden and visible. GMSC 07

Examples

toggle the form field 'TEST' in the current form

IG.form.getItemById('TEST').toggle();

disable()


disables the form item (and all its sub-items), i.e. making it non-editable. GMSC 07

Examples

disable the form field 'TEST' in the current form

IG.form.getItemById('TEST').disable();

enable()


enables the form item (and all its sub-items), i.e. making it editable. GMSC 07

Examples

enable the form field 'TEST' in the current form

IG.form.getItemById('TEST').enable();

serialize()


serizalizes the form item and all its sub-items meaning that a JSON object containing all the form items as key/value pairs is created. Can be used to persist a form on the server side. Attention: File input fields are not serialized.


Returns

{Object} An object containing the form item(s) as key/value pairs.

Example

Running IG.form.serialize() in the Browser's Javascript shell returns an object containing all the form fields as key/value pairs:

>>> JSON.stringify(IG.form.serialize())
"{"ConfigurationRequired":"True","Name":"sdf","Password":"sdf","Site":"GMSC_13"}"


isValid()


validates the given form items against their assigned validators (e.g. required, minLength,...). Returns true if the input of the form items matches the validators and false otherwise.


Returns

{Boolean} result of the validation (always true if no validators were assigned).

Examples

validate the form field 'TEST' in the current form

IG.form.getItemById('TEST').isValid();

getSettings()


returns the raw JSON configuration of the form item as contained in IG.formSettings. Can be used for debugging.


Returns

{Object} the settings as nested JSON Objet.

Examples

retrieve the settings of form field 'TEST' in the current form

IG.form.getItemById('TEST').getSettings();


Properties

kind


{String} the kind of the formitems, one of the following values: 'form', 'tab', 'group', 'field', 'action'


name


{Observable} the name of the formitem, referring as unique id. Attention: being an observable, you have to access it like so:

IG.form.getItemById('TEST').name();

visible


{Observable} or {Computed} the visibility state of the form item, either true or false. Attention: being an observable, you have to access it like so:

IG.form.getItemById('TEST').visible();

editable


{Observable} or {Computed} the editable state of the form item. Attention: being an observable, you have to access it like so:

IG.form.getItemById('TEST').editable();