Fix error messages position

This commit is contained in:
mauriziovitale84
2016-06-23 11:52:08 +01:00
parent d0fa3d8f19
commit 3e9d50bdca
2 changed files with 6 additions and 6 deletions

View File

@@ -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>
</div>
<div [ngClass]="{'is-invalid': isErrorStyle(form.controls.password)}"
<div
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"
class="icon-inline">
@@ -35,7 +34,7 @@
</i>
<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" />
<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>
</div>

View File

@@ -89,7 +89,7 @@ export class AlfrescoLoginComponent {
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) {
if (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) {
for (let key in this.form.controls[field].errors) {
if (key) {
@@ -164,6 +165,6 @@ export class AlfrescoLoginComponent {
if (typeof componentHandler !== 'undefined') {
componentHandler.upgradeAllRegistered();
}
return !field.valid;
return !field.valid && field.dirty && !field.pristine;
}
}