jQuery.fn.dynamicForm
This plugin manages dynamically defined forms and their properties. New instances of the dynamicForm plugin should not be manually created. Instances are initialized when they dynamic configuration form is rendered by the platform.
Methods
getValues
Gets an object representing all of the property id / value pairs in the form.
// get values
var v = $('SELECTOR').dynamicForm('getValues');
val
Gets or sets the value of the property with the specified id.
// get a value
var v = $('SELECTOR').dynamicForm('val', 'id_of_property');
// set a value
$('SELECTOR').dynamicForm('val', 'id_of_property', 'new_value');
dataType
Returns the string representation of the data type of the property specified by its identifier.
var dataType = $('SELECTOR').dynamicForm('dataType', 'id_of_property');
hasValue
Returns true if the property specified by its identifier (or all properties specified by an array of identifiers) has a value, otherwise false. For boolean properties, hasValue only returns true if the value of the boolean is true.
var hasValue = $('SELECTOR').dynamicForm('hasValue', 'id_of_property');
var allHaveValues = $('SELECTOR').dynamicForm('hasValue', ['id_of_property', 'id_of_property2', 'id_of_property3']);
onChange
Registers a function for notification when one or more properties are changed.
$('SELECTOR').dynamicForm('onChange', 'id_of_property', function(o) {
alert(o.id + ' changed to ' + o.val);
});
$('SELECTOR').dynamicForm('onChange', ['id_of_property', 'id_of_property2', 'id_of_property3'], function(o) {
alert(o.id + ' changed to ' + o.val);
});
hide
Attempts to hide the visual representation of one or more properties. A property is hidden when any source or sources (identified by sourceId) request the property to be hidden.
$('SELECTOR').dynamicForm('hide', 'id_of_property', 'id_of_source');
$('SELECTOR').dynamicForm('hide', ['id_of_property', 'id_of_property2', 'id_of_property3'], 'id_of_source');
show
Attempts to show the visual representation of one or more properties. A property is shown when no other sources (identified by sourceId) are hiding the property.
$('SELECTOR').dynamicForm('show', 'id_of_property', 'id_of_source');
$('SELECTOR').dynamicForm('show', ['id_of_property', 'id_of_property2', 'id_of_property3'], 'id_of_source');