no message

This commit is contained in:
annampak 2018-01-08 18:25:08 +02:00
parent abc114b8ab
commit 997d4b61da
4 changed files with 20 additions and 17 deletions

View File

@ -52,9 +52,7 @@
<div [hidden]="isValid"> <div [hidden]="isValid">
<mat-error *ngIf="isValidRequired"> <mat-error *ngIf="isValidRequired">The field "{{field.data.label}}" <strong>required</strong></mat-error>
The field "{{field.title}}" <strong>required</strong>
</mat-error>
<!-- <div class="invalid-feedbackCustom" *ngIf="isValidRequired">The field "{{field.label}}" is required</div> --> <!-- <div class="invalid-feedbackCustom" *ngIf="isValidRequired">The field "{{field.label}}" is required</div> -->
<div class="invalid-feedbackCustom" *ngIf="isValidPattern">The field {{field.label}} must match a regular expression {{field.regex}}</div> <div class="invalid-feedbackCustom" *ngIf="isValidPattern">The field {{field.label}} must match a regular expression {{field.regex}}</div>
<div class="invalid-feedbackCustom" *ngIf="isValidCustom">The field {{field.label}} custom Validation</div> <div class="invalid-feedbackCustom" *ngIf="isValidCustom">The field {{field.label}} custom Validation</div>

View File

@ -1,12 +1,17 @@
<div [id]="compositeField.id" [formGroup]="form"> <div [id]="compositeField.id" [formGroup]="form">
<div *ngIf="compositeField.fields.length == 1" class="fieldset-component">
<h5 *ngIf="compositeField.title">{{compositeField.title}}</h5> <h5 *ngIf="compositeField.title">{{compositeField.title}}</h5>
<div class="content-left-margin">
<h5 *ngIf="compositeField.description">{{compositeField.description}}</h5> <h5 *ngIf="compositeField.description">{{compositeField.description}}</h5>
<h5 *ngIf="compositeField.extendedDescription" class="fieldset-extended-desc"> <h5 *ngIf="compositeField.extendedDescription" class="fieldset-extended-desc">
<i>{{compositeField.extendedDescription}}</i> <i>{{compositeField.extendedDescription}}</i>
</h5> </h5>
<df-field *ngIf="compositeField.fields.length == 1" [field]="compositeField.fields[0]" [form]="form.get('fields').get(''+0)" <df-field *ngIf="compositeField.fields.length == 1" [field]="compositeField.fields[0]" [form]="form.get('fields').get(''+0)"
[pathName]="pathName+'.fields.'+0"></df-field> [pathName]="pathName+'.fields.'+0"></df-field>
</div>
</div>
<div *ngIf="compositeField.fields.length > 1" class="fieldset-component"> <div *ngIf="compositeField.fields.length > 1" class="fieldset-component">
<h5 *ngIf="compositeField.title">{{compositeField.title}}</h5> <h5 *ngIf="compositeField.title">{{compositeField.title}}</h5>

View File

@ -2,6 +2,7 @@ import { VisibilityRulesService } from '../../visibility-rules/visibility-rules.
import { FormGroup, Form, FormArray } from '@angular/forms'; import { FormGroup, Form, FormArray } from '@angular/forms';
import { Component, Input, OnInit, ViewEncapsulation } from '@angular/core'; import { Component, Input, OnInit, ViewEncapsulation } from '@angular/core';
import { CompositeField } from '../../models/CompositeField'; import { CompositeField } from '../../models/CompositeField';
import { Section } from '@app/models/Section';
@Component({ @Component({

View File

@ -22,6 +22,7 @@ export class Field extends BaseModel implements Serializable<Field>, FormGenerat
public multiplicityItems: Array<Field> = new Array<Field>(); public multiplicityItems: Array<Field> = new Array<Field>();
public data: any; public data: any;
public validations: Array<any>;//Array<ValidationTypes> public validations: Array<any>;//Array<ValidationTypes>
public validationRequired = false;
fromJSONObject(item: any): Field { fromJSONObject(item: any): Field {
this.id = item.id; this.id = item.id;
@ -47,18 +48,16 @@ export class Field extends BaseModel implements Serializable<Field>, FormGenerat
buildForm(): FormGroup { buildForm(): FormGroup {
let validationRequired = "false";
if(this.validations) if(this.validations)
this.validations.forEach(validation => { this.validations.forEach(validation => {
if (validation == "REQUIRED") if (validation == ValidationTypes.Required ) this.validationRequired = true;
{validationRequired = "true";}
}); });
let formGroup = this.formBuilder.group({ let formGroup = this.formBuilder.group({
id: [this.id], id: [this.id],
data:[this.data], data:[this.data],
/* title: [this.title], */ /* title: [this.title], */
value: [this.value, validationRequired == "true"? Validators.required:null]/* , value: [this.value, this.validationRequired == true? Validators.required:null]/* ,
description: [this.description], description: [this.description],
extendedDescription:[this.extendedDescription], extendedDescription:[this.extendedDescription],
viewStyle: [this.viewStyle], viewStyle: [this.viewStyle],