简体   繁体   English

如何检查文本框中的一个值是否大于另一个值,如果是,则显示跨度错误

[英]How to check if one value in textbox is greater than the other, if so show error in span

这些是 2 个文本框

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.

相关问题 如何在jQuery中检查一个值是否大于另一个值? 如果是,则显示警告框 - how to check exactly one value is greater than other in jquery? if so than alert box is show 如何检查一个值是否大于另一个 - How to check if one value is greater than other 如何检查一个文本框的值是否应小于另一个文本框的值,以及两个值的总和应不大于1 - How to check if one textbox value should be less than another textbox value and also the sum of both values should not be greater than 1 如何检查数组中是否存在值以及值的计数是否大于1? - How to check if a value exist in array and count of value is greater than one? 如何检查文本框是否为非空并且其值大于0而不是文本? - How to check if textbox is non-empty and that its value is greater than 0 and not text? 检查数组的值是否大于。 比做其他造型 - Check if value of array is greater than. Than do other styling 如何检查变量中是否有一个大于0 - How to check if any one of the variable is greater than 0 React - 为值大于 n 的结果显示一个结果 - React - Show one result for results that have a value greater than n jinja - 如何检查一个输入值是否小于另一个? - jinja - how to check if one input value is smaller than the other? 如何检查日期是否大于另一个日期? - How can I check if a date is greater than the other?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM