]> git.somenet.org - pub/jan/aic18.git/blob - camunda-overlay/forms/input-terms.html
Add online @ info + little polishing.
[pub/jan/aic18.git] / camunda-overlay / forms / input-terms.html
1 <form name="twitterForm" role="form">
2   <script cam-script type="text/form-script">
3     // angular form works on scope object
4     var terms = $scope.terms = [];
5
6     // scope function which adds a new term
7     $scope.addTerm = function() {
8       terms.push({});
9     };
10
11     camForm.on('form-loaded', function() {
12       // declare variable 'terms' incuding metadata for serialization
13       camForm.variableManager.createVariable({
14         name: 'terms',
15         type: 'json',
16         value: terms
17       });
18     });
19
20     camForm.on('submit', function() {
21       // remove '$$hashKey' properties
22       angular.forEach($scope.terms, function(term) {
23         delete term.$$hashKey;
24       });
25     });
26
27   </script>
28
29   <h3>Terms</h3>
30
31   <div ng-repeat="term in terms">
32     <div class="control-group">
33       <div class="controls">
34         <input id="term"
35                class="form-control"
36                type="text"
37                required
38                ng-model="term.term">
39       </div>
40     </div>
41   </div>
42   <a href
43      ng-click="addTerm()"
44      class="btn btn-default">Add</a>
45   <hr/>
46 </form>