Widget¶
This widget serves as a container for custom-built widgets, enabling advanced form designs tailored to specific interface needs. All customization is implemented using JavaScript.
XML Fields¶
XPathoptionally establishes the data context for the custom widget script. It does not persist a value unless the script explicitly uses the form API to do so.InitializeScript/Contentcontains the JavaScript run when the widget is initialized.$Containeris the widget's host element supplied to that script.Hintsprovides user guidance andRulescontains the form rules that control the widget.
Custom Widget code runs in the form page. Keep the script small, avoid loading untrusted code, and validate all data written through form APIs; the XML definition provides no automatic input or validation behavior beyond its configured rules.
JavaScript Customization¶
The $Container variable, passed to the initialization script, represents a jQuery object referring to the widget's container element. This allows for complete control over the widget's rendering and behavior using jQuery and JavaScript.
Examples¶
Example: Basic Usage
1 2 3 4 5 6 7 8 9 | |
This example uses the InitializeScript to inject the text "Hello!" into the widget's container. More complex widgets would use JavaScript to create interactive UI elements and bind them to the data model. Remember that the XPath property is optional and is used for binding the widget to a specific location in the data model, if required.
Example: Custom plugin
Loading highcharts gantt chart plugin and rendering a gantt chart.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | |