[英]How to check if one value in textbox is greater than the other, if so show error in span
I want to check that Per Transacation Limit cannot be greater than Per Day Transaction Limit.我想检查每笔交易限制不能大于每天交易限制。
This is what I have so far:这是我到目前为止所拥有的:
<input appNoSpace appTrimOnBlur appNumberOnly maxlength="10" [ngClass]="userUpdateForm.get('perDayTxnLimit').value?'is-invalid':''" class="form-control" type="text" commissionValues (keyup)=" checkTransactionValues(perDayTxnLimit,i,$event)" (focusout)=" checkTransactionValues(perDayTxnLimit,i,$event)" id="perTxnLimit" formControlName="perTxnLimit">
<span *ngIf="userUpdateForm.controls.perTxnLimit.errors?.required && userUpdateForm.controls.perTxnLimit.touched">
<small class="form-text error">Per Transacation Limit cannot be greater than Per Day Transaction Limit</small>
</span>
Please tell me if I can do it with a function checkTransactionValues() in Javascript or anything else?请告诉我是否可以使用 Javascript 中的 function checkTransactionValues() 或其他任何东西来做到这一点?
We can put that logic in checkTransactionValues()
in typescript.我们可以将该逻辑放在 typescript 中的checkTransactionValues()
中。
Here is a quick stackblitz: https://stackblitz.com/edit/angular-ivy-62442698这是一个快速堆栈闪电战: https://stackblitz.com/edit/angular-ivy-62442698
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.