Fixed changes asked on PR - fixed unstable form

This commit is contained in:
Vito Albano
2016-11-25 10:43:43 +00:00
committed by Mario Romano
parent 9c3fa30a0b
commit c418c2e1d5
3 changed files with 4 additions and 3 deletions

View File

@@ -54,6 +54,7 @@ export class DisplayValueWidget extends WidgetComponent implements OnInit, After
ngOnInit() {
if (this.field) {
this.value = this.field.value;
this.visibilityService.refreshEntityVisibility(this.field);
if (this.field.params) {
let originalField = this.field.params['field'];
if (originalField && originalField.type) {

View File

@@ -5,7 +5,7 @@
[attr.id]="field.id"
[(ngModel)]="field.value"
(ngModelChange)="checkVisibility(field)">
<option *ngFor="let opt of field.options" [value]="getOptionValue(opt)" [id]="opt.id">{{opt.name}}</option>
<option *ngFor="let opt of field.options" [value]="getOptionValue(opt, field.value)" [id]="opt.id">{{opt.name}}</option>
</select>
<span *ngIf="field.validationSummary" class="mdl-textfield__error">{{field.validationSummary}}</span>
</div>

View File

@@ -82,9 +82,9 @@ export class DropdownWidget extends WidgetComponent implements OnInit {
);
}
getOptionValue(option: FormFieldOption): string {
getOptionValue(option: FormFieldOption, fieldValue: string): string {
let optionValue: string = '';
if (option.id === 'empty' || option.name !== this.field.value) {
if (option.id === 'empty' || option.name !== fieldValue) {
optionValue = option.id;
} else {
optionValue = option.name;