Merge branch 'master' of git@gitlab.eudat.eu:dmp/OpenAIRE-EUDAT-DMP-service-pilot.git
This commit is contained in:
commit
55e4556167
|
@ -70,7 +70,7 @@
|
||||||
|
|
||||||
<div class="panel-footer">
|
<div class="panel-footer">
|
||||||
<div class="progress">
|
<div class="progress">
|
||||||
<div class="progress-bar" role="progressbar" aria-valuenow="70"
|
<div class="progress-bar" role="progressbar" aria-valuenow= ""
|
||||||
aria-valuemin="0" aria-valuemax="100" [ngStyle]="{'width': dirtyValues + '%'}">
|
aria-valuemin="0" aria-valuemax="100" [ngStyle]="{'width': dirtyValues + '%'}">
|
||||||
{{dirtyValues}}%
|
{{dirtyValues}}%
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -56,9 +56,9 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div [hidden]="isValid">
|
<div [hidden]="isValid">
|
||||||
<div class="invalid-feedbackCustom" *ngIf="isValidRequired">{{field.label}} is required</div>
|
<div class="invalid-feedbackCustom" *ngIf="isValidRequired">The field "{{field.label}}" is required</div>
|
||||||
<div class="invalid-feedbackCustom" *ngIf="isValidPattern">{{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">{{field.label}} custom Validation</div>
|
<div class="invalid-feedbackCustom" *ngIf="isValidCustom">The field {{field.label}} custom Validation</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -66,13 +66,17 @@ export class DynamicFormFieldComponent {
|
||||||
}
|
}
|
||||||
FieldValueRuleMethod(field, rule) { //fieldValue rule -- checks the value of target and apply rules, at the same time when the field becomes visible
|
FieldValueRuleMethod(field, rule) { //fieldValue rule -- checks the value of target and apply rules, at the same time when the field becomes visible
|
||||||
if (rule._ruleStyle == "range") { //calling the AddvalidationRules we apply the validation rules for the new field
|
if (rule._ruleStyle == "range") { //calling the AddvalidationRules we apply the validation rules for the new field
|
||||||
this.dataModel.fields.forEach(fld => {
|
var targetField = this.dataModel.getFieldByKey(rule._target);
|
||||||
if (fld.key == rule._target && rule._from < fld.value < rule._to) {
|
if (parseInt(rule._from) < parseInt(field.value) && parseInt(field.value)< parseInt(rule._to)) {
|
||||||
console.log("visible" + fld.value)
|
console.log("visible" + field.value)
|
||||||
field.visible = true;
|
targetField.visible = true;
|
||||||
|
this.AddvalidationRules(rule._target);
|
||||||
|
}else{
|
||||||
|
targetField.visible = false;
|
||||||
|
this.form.controls[rule._target].clearValidators(); // when a field is hidden must clear the validators and the errors
|
||||||
|
this.form.controls[rule._target].updateValueAndValidity();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
if (rule._ruleStyle == "boolean") { //boolean Decision field
|
if (rule._ruleStyle == "boolean") { //boolean Decision field
|
||||||
let ruleValue = rule.value.__text;
|
let ruleValue = rule.value.__text;
|
||||||
|
|
Loading…
Reference in New Issue