PD Loan Form Validation : ps

This commit is contained in:
venbatechnologies@gmail.com 2018-11-21 14:55:23 +05:30
parent 98590c363f
commit cc9cbd52e1
2 changed files with 21 additions and 2 deletions

View File

@ -24,7 +24,7 @@
<input matInput placeholder="Specify End Use" formControlName="end_use_other">
</mat-form-field>
<mat-form-field>
<mat-select placeholder="Is there a balance transfer"
<mat-select placeholder="Is there a balance transfer" (selectionChange)="selectedBalancesTransferChanges($event)"
formControlName="is_transfer" required>
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>

View File

@ -170,7 +170,8 @@ getM_sourceofamount() {
end_use: ['', Validators.compose([Validators.required])],
end_use_other: [''],
is_transfer: ['', Validators.compose([Validators.required])],
is_topup: ['', Validators.compose([Validators.required])],
//is_topup: ['', Validators.compose([Validators.required])],
is_topup: [''],
balance_transfer_amount: [''],
topup_amount: [''],
lender: [''],
@ -204,6 +205,7 @@ getM_sourceofamount() {
submitLoanDetails() {
console.log('formData', this.loanDetailsForm.value);
if (!this.loanDetailsForm.valid) {
//this.notifier.notify('warning', 'Form Invaild Check all requried Field .!');
return;
}
let records: any = {};
@ -269,6 +271,23 @@ getM_sourceofamount() {
}
});
}
selectedBalancesTransferChanges(event: any){
// console.log('First Time',event);
// console.log('First Time Value',event.value);
if(event.value == 'no') {
this.loanDetailsForm.controls['is_topup'].clearValidators();
this.loanDetailsForm.controls['is_topup'].updateValueAndValidity();
// console.log('no',event.value);
}
else if(event.value == 'yes'){
this.loanDetailsForm.controls['is_topup'].setValidators([Validators.required]);
this.loanDetailsForm.controls['is_topup'].updateValueAndValidity();
// console.log('yes',event.value);
}
}
/** On Key Press Event For Amount */
keyPress(event: any) {
const pattern = /[0-9]/;