#726 dropdown and typeahead validation

fixes #743
This commit is contained in:
Denys Vuika
2016-09-14 18:01:53 +01:00
parent 1adc87bc67
commit e99b48a6da
10 changed files with 96 additions and 27 deletions

View File

@@ -36,18 +36,24 @@ export class DropdownWidget extends WidgetComponent implements OnInit {
}
ngOnInit() {
this.formService
.getRestFieldValues(
this.field.form.taskId,
this.field.id
)
.subscribe(
(result: FormFieldOption[]) => {
this.field.options = result || [];
this.field.updateForm();
},
this.handleError
);
if (this.field && this.field.restUrl) {
this.formService
.getRestFieldValues(
this.field.form.taskId,
this.field.id
)
.subscribe(
(result: FormFieldOption[]) => {
let options = [];
if (this.field.emptyOption) {
options.push(this.field.emptyOption);
}
this.field.options = options.concat((result || []));
this.field.updateForm();
},
this.handleError
);
}
}
handleError(error: any) {