mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
Fix error messages position
This commit is contained in:
@@ -18,8 +18,7 @@
|
|||||||
<span id="username-error" class="mdl-textfield__error" style="visibility: visible" data-automation-id="username-error">{{formError.username | translate }}</span>
|
<span id="username-error" class="mdl-textfield__error" style="visibility: visible" data-automation-id="username-error">{{formError.username | translate }}</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
<div [ngClass]="{'is-invalid': isErrorStyle(form.controls.password)}"
|
|
||||||
class="center mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
|
class="center mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
|
||||||
<i [ngClass]="{hide: isPasswordShow}" [ngClass]="{show: !isPasswordShow}" (click)="toggleShowPassword()" data-automation-id="show_password"
|
<i [ngClass]="{hide: isPasswordShow}" [ngClass]="{show: !isPasswordShow}" (click)="toggleShowPassword()" data-automation-id="show_password"
|
||||||
class="icon-inline">
|
class="icon-inline">
|
||||||
@@ -35,7 +34,7 @@
|
|||||||
</i>
|
</i>
|
||||||
<label for="password" class="mdl-textfield__label">{{'LOGIN.LABEL.PASSWORD' | translate }}</label>
|
<label for="password" class="mdl-textfield__label">{{'LOGIN.LABEL.PASSWORD' | translate }}</label>
|
||||||
<input type="password" class="mdl-textfield__input" id="password" data-automation-id="password" ngControl="password" tabindex="2" />
|
<input type="password" class="mdl-textfield__input" id="password" data-automation-id="password" ngControl="password" tabindex="2" />
|
||||||
<span class="mdl-tooltip--validation is-active" for="password" *ngIf="formError.password">
|
<span class="mdl-tooltip--validation" for="password" *ngIf="formError.password">
|
||||||
<span id="password-required" class="mdl-textfield__error" style="visibility: visible" data-automation-id="password-required">{{formError.password | translate }}</span>
|
<span id="password-required" class="mdl-textfield__error" style="visibility: visible" data-automation-id="password-required">{{formError.password | translate }}</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -89,7 +89,7 @@ export class AlfrescoLoginComponent {
|
|||||||
|
|
||||||
this.form.valueChanges.subscribe(data => this.onValueChanged(data));
|
this.form.valueChanges.subscribe(data => this.onValueChanged(data));
|
||||||
|
|
||||||
this.onValueChanged(null);
|
// this.onValueChanged(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -131,7 +131,8 @@ export class AlfrescoLoginComponent {
|
|||||||
for (let field in this.formError) {
|
for (let field in this.formError) {
|
||||||
if (field) {
|
if (field) {
|
||||||
this.formError[field] = '';
|
this.formError[field] = '';
|
||||||
let hasError = this.form.controls[field].errors || (this.form.controls[field].dirty && !this.form.controls[field].valid);
|
let hasError = (this.form.controls[field].errors && !this.form.controls[field].pristine) ||
|
||||||
|
(this.form.controls[field].dirty && !this.form.controls[field].valid);
|
||||||
if (hasError) {
|
if (hasError) {
|
||||||
for (let key in this.form.controls[field].errors) {
|
for (let key in this.form.controls[field].errors) {
|
||||||
if (key) {
|
if (key) {
|
||||||
@@ -164,6 +165,6 @@ export class AlfrescoLoginComponent {
|
|||||||
if (typeof componentHandler !== 'undefined') {
|
if (typeof componentHandler !== 'undefined') {
|
||||||
componentHandler.upgradeAllRegistered();
|
componentHandler.upgradeAllRegistered();
|
||||||
}
|
}
|
||||||
return !field.valid;
|
return !field.valid && field.dirty && !field.pristine;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user