Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Form script allows to perform operations before form is rendered or attach data model elements to get notifications. Form script also have some library functions like $Xml depending on context. Please refer to side bar for available library functions and scripting reference.

Form script also have following $Form variable with following properties;

$Form = {
  element : $('form'),       // jQuery form element
  refresh : function() {}    // method to re-build and render form from scratch
  readonly : boolean,        // Specifies the form is in readonly or edit mode
}

Common Usage Scenarios

Attach Event Handlers.

Attach to existing a data model element. 

$Xml.Bind('Person/Name', function() {
   // executed when Person/Name is changed
));

Above example is normally works if Name element exists in Person element. But some elements may not exist yet when form rendered. For example Bind method does not work for list items that not yet created. If you want to attach nodes for future elements you can use $Xml.Live method.

$Xml.Live('List/Item/Amount', function() {
   // executed when List/Item/Amount is changed
));

Use Custom jQuery Plugins

// attach jquery event to form ready event
$Form.element.on('ready', function() {
   // find custom added panel and initialize plugin
   $Form.element.find('.myCustomPanel').myCustomPlugin();
});



  • No labels