I am retrieving a rendered form via the camunda rest api (/task/{id}/rendered-form endpoint). This endpoint returns an HTML response like this one:
<form name="generatedForm" role="form">
<div class="form-group">
<label for="field1">
field1
</label>
<input class="form-control" name="field1" cam-variable-type="String" cam-variable-name="field1" type="text" value="test" />
</div>
<div class="form-group">
<label for="field2">
field2
</label>
<input class="form-control" name="field2" cam-variable-type="Boolean" cam-variable-name="field2" type="checkbox" value="true" />
</div>
<div class="form-group">
<label for="field3">
field3
</label>
<select class="form-control" name="field3" cam-variable-type="String" cam-variable-name="field3">
<option value="key1">
option 1
</option>
<option value="key2">
option 2
</option>
</select>
</div>
</form>
which will be embedded inside an angular app like this :
Template :
<div class="top">
<div [innerHtml]="taskFormHtml"></div>
</div>
Typescript:
@Input() taskId: string;
taskFormHtml: SafeHtml;
constructor(private _domSanitizer: DomSanitizer,
private _taskService: TaskService) {
}
ngOnInit(): void {
this.loadForm();
}
loadForm(): void {
this._taskService.getTaskRenderedForm(this.taskId).subscribe(renderedForm => {
this.taskFormHtml = this._domSanitizer.bypassSecurityTrustHtml(renderedForm);
});
}
Now, how can I listen to those form field changes inside the angular app and then submit them via the submit form enpoint (POST /task/{id}/submit-form) ?