diff --git a/dmp-frontend/src/app/app.component.css b/dmp-frontend/src/app/app.component.css index a5d0bf7e9..578792487 100644 --- a/dmp-frontend/src/app/app.component.css +++ b/dmp-frontend/src/app/app.component.css @@ -4,4 +4,15 @@ .show { display:block; -} \ No newline at end of file +} + +.ng-valid[required], .ng-valid.required { + border-left: 5px solid #42A948; /* green */ + } + + .ng-invalid:not(form) { + border-left: 5px solid #a94442; /* red */ + } + .errorMessage{ + color:red; + } \ No newline at end of file diff --git a/dmp-frontend/src/app/form/dynamic-form.component.ts b/dmp-frontend/src/app/form/dynamic-form.component.ts index 30e735907..cacaad3f6 100644 --- a/dmp-frontend/src/app/form/dynamic-form.component.ts +++ b/dmp-frontend/src/app/form/dynamic-form.component.ts @@ -20,37 +20,20 @@ import { GroupBase } from './dynamic-form-group/group-base'; export class DynamicFormComponent implements OnInit { @Input() dataModel: DataModel = new DataModel(); - form: FormGroup; - - payLoad = ''; - - - + form: FormGroup; + payLoad = ''; constructor(private qcs: FieldControlService, private serverService: ServerService, private dataModelService: dataModelBuilder, private router: Router, private route: ActivatedRoute) { this.form = this.qcs.toFormGroup(new Array(), new Array()); } - - getSubForm(subformName){ - return this.form.controls[subformName]; - } + + getSubForm(subformName){ + return this.form.controls[subformName]; + } ngOnInit() { - /* - //this.form = this.qcs.toFormGroup(this.fields); - this.serverService.getHTTPFields() - .subscribe( - (data: any[]) => { - this.fields = this.fieldVisibility.getFieldVisibility(data); - this.form = this.qcs.toFormGroup(this.fields); - console.log(this.fields); - }, - (error) => console.log(error) - ); - //this.buildForm(); - */ console.log("DynamicFormComponent.ngOnInit() -- RUNNIGN"); @@ -75,29 +58,6 @@ export class DynamicFormComponent implements OnInit { }, (error) => console.log(error) ); - /* - - this.serverService.getFields() - .subscribe( - (data: any[]) => { - - console.log("this.serverService.getFields"); - - this.dataModel = new DataModel(); - this.dataModel = this.fieldVisibility.getDataModel(data); - - this.form = this.qcs.toFormGroupAlt(this.dataModel.fields, this.dataModel.groups); - //this.form = this.qcs.toFormGroup(this.fields); - - console.log("SUMMARY: ======>"); - console.log(this.dataModel); - console.log(this.form); - - }, - (error) => console.log(error) - ); - - */ } diff --git a/dmp-frontend/src/app/form/fields/dynamic-form-field.component.html b/dmp-frontend/src/app/form/fields/dynamic-form-field.component.html index 49f7c1c15..9c6747eda 100644 --- a/dmp-frontend/src/app/form/fields/dynamic-form-field.component.html +++ b/dmp-frontend/src/app/form/fields/dynamic-form-field.component.html @@ -52,9 +52,12 @@ - - + + +
{{field.label}} is required
+ +