Datapolis Process System

Search:

Contents
:
IndexBookmarkPrint
Home > User Guide > Creating Workflows > Workflow Designer > Action Launch Forms [HIDDEN] > Quick Form > JavaScript Object Model

JavaScript Object Model

 

You can extend your Quick Form behavior with custom JavaScript code.

 

The object model was built with jQuery v 1.11.3.

 

The current form Java Script object representation is available in Datapolis.Forms.currentForm variable:

 

var form = Datapolis.Forms.currentForm;

Datapolis.Forms.currentForm is the instance of  Datapolis.Forms.ActionForm.

Datapolis.Forms.ActionForm members:

  1. formHeader - form header html element reference (jQuery object)
  2. formFooter - form footer html element reference (jQuery object)
  3. actionName - current action name
  4. redirectURL - selected custom form redirect url
  5. validate() parameter less function that trigger the client validation function on all fields
  6. fields - the form fields collection (Datapolis.Forms.ActionFormField instances
  7. customData - function that can be used to store some data between postback, use .customData() as getter and .customData(data) as setter

 To manipulate the form field use the Datapolis.Forms.currentForm.fields collection. Use the field identifier that has been chosen in action parameter setting window to get field object:

 

var field_category = Datapolis.Forms.currentForm.fields["category"];

Field object is the instance of  Datapolis.Forms.ActionFormField.

Datapolis.Forms.ActionFormField members:

  1. fieldId - field client id
  2. fieldType - field type - Datapolis.Forms.FieldType enum:
    • TextSingleLine: 1,
    • Number: 2,
    • TextMultiLine: 3,
    • List: 4,
    • DateTime: 5,
    • Boolean: 6,
    • PersonOrGroup: 7,
    • File: 8,
    • Unused: 9,
    • CustomFieldControl: 10
  3. name - the name of the field (used in html element naming/tagging with fieldName attribute)
  4. title - field title html element reference (jQuery object)
  5. description - field description html element reference (jQuery object)
  6. defaultValue - initial field value
  7. propeties - additional field type specific settings,
  8. isReadOnly - ture if field is read only,
  9. isRequired - true if field is required,
  10. element - field value control html element reference (jQuery object)
  11. refresh() - function that force field refresh (reloads the fields and recalculate its value )
  12. customOnChange - your custom on change function reference*,
      

    You can also assign the different function in run time, function header is
    function(field, args) where:
    • field - related Datapolis.Forms.ActionFormField
    • args = {
      sender:  the jQuery reference to that dom element that trigger the event, 
      event:  the original event, 
      value:  current field value, 
      cancel:  set to true to cancel the on change flow execution, field validation and refresh will be stopped (default value is false), 
      };
  13. customOnValidate - your client side custom validation function reference,
      

    You can also assign the different function in run time, function header is function(field, args) where:
    • field - related Datapolis.Forms.ActionFormField
    • args = { 
      sender:  the jQuery reference to the DOM element that trigger the event, event:  the original event, 
      value:  current field value, 
      msg:  use to assign your validation message (required to proper validation handling when isValid value is set to false: args.isValid = false;), 
      isValid: set to false if value is invalid (default value is true), 
      cancelIfInvalid: set to false to force on change flow execution if value is invalid, related fields refresh will not be stopped (default value is true),
      };
  14. refreshFields - list of related Datapolis.Forms.ActionFormField selected in field setting Refresh Parameters section:

  15. visible() - function that sets and gets the field visibility, use .visible() to get the field visibility status, use .visible(trueor .visible(false) to show or hide field
    There is an option to define the hide/show animation, if you pass the additional parameter to the .visible function .visible(true/false,mode):
    If mode is:
    1 - fade animation will be used
    2 - slide animation will be used
    9 - you can define four own animation function by passing it as third parameter  .visible(true/false,mode, function (element, show) {...}) where
    - element - the html field element (jQuery object)
    - show -  true/false value passed to .visible function
  16. enable() - function that enable or disable the field, use .enable() to get the value, use .enable(trueor .enable(false) to enable or disable the field
  17. value()/val() - function that sets and gets the field value, use .value() to get the field value, use .value(newValto set the field value
    Depends on fieldType function .value(newVal) will accept data in following formats:
    • TextSingleLine: string,
    • Number: integer or double depend on field specification,
    • TextMultiLine: html string,
    • List: string or array of string for multi-select list box,
    • DateTime: Date,
    • Boolean: true/false,
    • PersonOrGroup: list of objects [{key: "login", disp: "disp. name"}, ...]
    • File: cannot be set,
    • CustomFieldControl: value format depends on field implementation, override Dictionary<ClientFunctionsstring> GetClientFunctionNames() method in your custom field implementation to expose your function to the Datapolis Java Script Object Model
  18. validate() - function that trigger the field value client validation

 

*  - peoplePicker curettly do not support custom 'OnChanged' function.

        1.      event: 	the orginal event
               value: 	current field value
               cancel: 	set to true cancel the on chnage flow execution, field validation and refresh will be stopped
            };
      customOnChange - your custom on change function reference, you can assigner the different function in run time, function format is function(field, args) where:
      1. field - related Datapolis.Forms.ActionFormField
      2. args = {
             sender: 	the jQuery reference to that dom element that trigger the event
             event: 	the orginal event
             value: 	current field value
             cancel: 	set to true cancel the on chnage flow execution, field validation and refresh will be stopped
          };
    formHeader - form header jQuery dom element reference
  • formFooter - form footer jQuery dom element reference
  • formHeader - form header jQuery dom element reference
  • formFooter - form footer jQuery dom element reference
  • formHeader - form header jQuery dom element reference
  • formFooter - form footer jQuery dom element reference
  •