textarea field

This commit is contained in:
annampak 2017-11-06 12:38:58 +02:00
parent ac1efd90b2
commit 728c21a515
3 changed files with 29 additions and 1 deletions

View File

@ -44,7 +44,8 @@
(change)="toggleVisibility($event, field, true)" [required]="field.required" [checked]="form.get(field.key).value"> <!--(change)="field.value = ckb.checked" has moved into the toggleVisibility
// without property [checked] as pages change the checkboxes of the previous pages lose the checked pro [checked] = "field.value" #ckb -->
<textarea *ngSwitchCase="'textarea'" class="form-control" [formControlName]="field.key" [id]="field.key"
[required]="field.required" (ngModelChange) = "toggleVisibility($event, field,false)"> </textarea>
<div *ngSwitchCase="'radiobox'">
<ng-container *ngFor="let answrBase of field.answers">

View File

@ -0,0 +1,11 @@
import {FieldBase} from '../field-base';
export class TextAreaField extends FieldBase<string> {
controlType = 'textarea';
type: string;
constructor (options: {} = {}) {
super(options);
this.type = options['type'] || '';
}
}

View File

@ -4,6 +4,7 @@ import { FieldBase } from '../../app/form/fields/field-base';
import { TextboxField } from '../../app/form/fields/textbox/field-textbox';
import { CheckBoxField } from '../../app/form/fields/checkbox/field-checkbox';
import { RadioBoxField } from '../../app/form/fields/radiobox/field-radiobox';
import { TextAreaField } from '../../app/form/fields/textarea/textarea';
import { DataModel } from '../entities/DataModel';
import { Rule } from '../entities/common/rule';
import { GroupBase } from '../form/dynamic-form-group/group-base';
@ -113,6 +114,21 @@ export class dataModelBuilder {
value: false
}]
});
fieldsVisible.push(newfield);
}else if (element.viewStyle._renderstyle == "textarea") {
let newfield: FieldBase<any>;
let rule = new Rule();
newfield = new TextAreaField({
label: element.title.__cdata,
key: element._id,
value: element.value,
order: element._ordinal,
rules: element.visible.rule != undefined ? element.visible.rule : rule,
visible: element._defaultVisibility,
group: element._group,
description: element.description.__cdata
});
fieldsVisible.push(newfield);
}
});