diff --git a/src/app/room-creation/room-creation.component.html b/src/app/room-creation/room-creation.component.html index d930026e1f8bf5f72540fa1b4382c2da9ef8e403..75666e5360428f647b6b8b9102f828f3d6bac522 100644 --- a/src/app/room-creation/room-creation.component.html +++ b/src/app/room-creation/room-creation.component.html @@ -1,26 +1,28 @@ -<div fxLayout="column" fxLayoutAlign="center" fxLayoutGap="10px"> - <mat-form-field> - <input (keypress)="resetEmptyInputs()" matInput #longRoomName class="input-block" type="text" placeholder="Name" - maxlength="50" - [(ngModel)]="longName"/> - <mat-hint align="start" *ngIf="!emptyInputs"><strong>Max. letters / signs:</strong></mat-hint> - <mat-hint align="end" *ngIf="!emptyInputs">{{longRoomName.value.length}} / 50</mat-hint> - <mat-hint align="start" *ngIf="emptyInputs"><strong>Input is required</strong></mat-hint> - <button mat-button *ngIf="longName" matSuffix mat-icon-button aria-label="Clear" (click)="longName=''"> - <mat-icon>close</mat-icon> +<form (ngSubmit)="addRoom(longRoomName.value, shortRoomName.value)"> + <div fxLayout="column" fxLayoutAlign="center" fxLayoutGap="10px"> + <mat-form-field> + <input (keypress)="resetEmptyInputs()" matInput #longRoomName class="input-block" type="text" placeholder="Name" + maxlength="50" + [(ngModel)]="longName"/> + <mat-hint align="start" *ngIf="!emptyInputs"><strong>Max. letters / signs:</strong></mat-hint> + <mat-hint align="end" *ngIf="!emptyInputs">{{longRoomName.value.length}} / 50</mat-hint> + <mat-hint align="start" *ngIf="emptyInputs"><strong>Input is required</strong></mat-hint> + <button mat-button *ngIf="longName" matSuffix mat-icon-button aria-label="Clear" (click)="longName=''"> + <mat-icon>close</mat-icon> + </button> + </mat-form-field> + <mat-form-field> + <input (keypress)="resetEmptyInputs()" matInput #shortRoomName class="input-block" type="text" + placeholder="Short name" maxlength="8" + [(ngModel)]="shortName"/> + <mat-hint align="start" *ngIf="!emptyInputs"><strong>Max. letters / signs:</strong></mat-hint> + <mat-hint align="end" *ngIf="!emptyInputs">{{shortRoomName.value.length}} / 8</mat-hint> + <mat-hint align="start" *ngIf="emptyInputs"><strong>Input is required</strong></mat-hint> + <button mat-button *ngIf="shortName" matSuffix mat-icon-button aria-label="Clear" (click)="shortName=''"> + <mat-icon>close</mat-icon> + </button> + </mat-form-field> + <button mat-raised-button color="primary" type="submit">Create room </button> - </mat-form-field> - <mat-form-field> - <input (keypress)="resetEmptyInputs()" matInput #shortRoomName class="input-block" type="text" - placeholder="Short name" maxlength="8" - [(ngModel)]="shortName"/> - <mat-hint align="start" *ngIf="!emptyInputs"><strong>Max. letters / signs:</strong></mat-hint> - <mat-hint align="end" *ngIf="!emptyInputs">{{shortRoomName.value.length}} / 8</mat-hint> - <mat-hint align="start" *ngIf="emptyInputs"><strong>Input is required</strong></mat-hint> - <button mat-button *ngIf="shortName" matSuffix mat-icon-button aria-label="Clear" (click)="shortName=''"> - <mat-icon>close</mat-icon> - </button> - </mat-form-field> - <button mat-raised-button color="primary" (click)="addRoom(longRoomName.value, shortRoomName.value)">Create room - </button> -</div> + </div> +</form>