0
I’m making a form with 3 fields, where the first fields is unlocked and the others blocked. They unlock according to the first field, for example:
User typed in the first field -> unlocks the second -> typed in the second field -> unlocks the third
I implemented it that way, but it didn’t work. What I’m doing wrong?
<div class="ui-g-12 ui-md-3">
<input id="dia" label="dia" minLenght="2" maxlength="2" (keyup)="showSearch($event)"></input>
</div>
<div class="ui-g-12 ui-md-3">
<input id="mes" label="Mes" (keyup)="showSearch($event)"></msp-input-text>
</div>
<div class="ui-g-12 ui-md-3">
<autocomplete id="ano" label="ano" (keyup)="showSearch($event)">
</autocomplete>
</div>
showSearch(event){
this.form.get('dia').valueChanges.subscribe(value => {
if(value){
this.form.get('campo2').enable
}
})
}
then the method is right, would only be added the method? I was in doubt for the third field
– fernanda
the method enables or disables the fields... The logic for your problem would be more or less what I sent above. I removed the valueChanges pq it detects changes in the form/input you don’t need it, because you already took an event that identifies these changes in the input that is the (keyup)
– Júlio Saldanha