Enabling the input field on selecting the dropdown

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Enabling the input field on selecting the dropdown



HTML


<mat-form-field class="id-name" >
<mat-select placeholder="ID Card" formControlName="IDproof">
<mat-option *ngFor="let IDproof of IDproofs" [value]="IDproof.value" >
IDproof.viewValue
</mat-option>
</mat-select>

</mat-form-field>

<mat-form-field class="id-number" >
<input matInput >
</mat-form-field>



I am having on option list and one basic input field like shown in below image



enter image description here



How can I make the input field active after selecting the option from the option list. Until I select any one option from the list it should be disabled and after selecting that input field should be filled(required). How can I achieve this?





there is a disabled attribute that you can set in the <input> based on the value of the select
– CruelEngine
Aug 13 at 5:45


disabled


<input>


select




1 Answer
1



use [disabled] property,


[disabled]



I have create a demo on Stackblitz


<input matInput [disabled]="myForm.get('IDproof').value">





ERROR Error: Cannot find control with name: 'IDproof' Showing this error.
– Venetian Village
Aug 13 at 6:05



ERROR Error: Cannot find control with name: 'IDproof'





Not [disabled]="!myForm.get('IDproof').value"?? with the !
– Tim Martens
Aug 13 at 6:06



[disabled]="!myForm.get('IDproof').value"


!





stackblitz.com/edit/…
– Krishna Rathore
Aug 13 at 6:10





Still getting the same error.
– Venetian Village
Aug 13 at 6:17





plz check URL. I have create demo on Stackblitz.
– Krishna Rathore
Aug 13 at 6:18






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

make 2 or more post in bootsrap

Store custom data using WC_Cart add_to_cart() method in Woocommerce 3

Firebase Auth - with Email and Password - Check user already registered