I am facing a challenge with 2 dropdown values and input fields, where I want to combine the selected values from the dropdowns into the input field.
Below is the HTML code snippet:
<div class="form-group">
<label>{{l("RoomType")}}</label>
<p-dropdown [disabled]="!roomTypes.length" [options]="roomTypes" autoWidth="false" [style]="{'width':'100%'}"
name="roomTypes" [autoWidth]="true" [(ngModel)]="room.roomTypeId"></p-dropdown>
</div>
<div class="form-group">
<label>{{l("RoomNumber")}}</label>
<p-dropdown [disabled]="!roomNumber.length" [options]="roomNumber" autoWidth="false" [style]="{'width':'100%'}"
name="roomTypes" [autoWidth]="true" [(ngModel)]="room.roomNumber"></p-dropdown>
</div>
<div class="form-group">
<label>{{l("RoomName")}}</label>
<input #roomNameInput="ngModel" class="form-control" type="text" name="roomName" [(ngModel)]="room.roomName"
maxlength="32">
</div>
I am looking for a way to automatically populate the value of RoomName
by combining the selected values from RoomType
and RoomNumber
when they are chosen. Any ideas on how to achieve this?