mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2025-02-21 22:11:59 +01:00
show error if not valid amount
can't actually prevent the input to deny letters
This commit is contained in:
parent
1124b59a9e
commit
8354d9b81c
2 changed files with 14 additions and 0 deletions
|
@ -330,6 +330,7 @@
|
|||
:min="receive.minMax[0]"
|
||||
:max="receive.minMax[1]"
|
||||
:readonly="receive.lnurl && receive.lnurl.fixed"
|
||||
inputmode="numeric"
|
||||
></q-input>
|
||||
</q-card-section>
|
||||
<q-separator></q-separator>
|
||||
|
@ -355,6 +356,8 @@
|
|||
:min="receive.minMax[0]"
|
||||
:max="receive.minMax[1]"
|
||||
:readonly="receive.lnurl && receive.lnurl.fixed"
|
||||
error-message="Not a valid amount"
|
||||
:error="!isValid"
|
||||
>
|
||||
</q-input>
|
||||
<div class="col-2 self-end">
|
||||
|
|
|
@ -97,6 +97,17 @@ window.WalletPageLogic = {
|
|||
.formatCurrency(0, this.receive.unit)
|
||||
.replace(/[\d.\s]/g, '')
|
||||
.trim()
|
||||
},
|
||||
isValid() {
|
||||
if (!this.receive.data.amount) return true
|
||||
return (
|
||||
this.receive.data.amount >= this.receive.minMax[0] &&
|
||||
this.receive.data.amount <= this.receive.minMax[1] &&
|
||||
!isNaN(this.receive.data.amount) &&
|
||||
this.receive.data.amount > 0 &&
|
||||
!isNaN(parseFloat(this.receive.data.amount)) &&
|
||||
/^\d*\.?\d*$/.test(this.receive.data.amount)
|
||||
)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
|
Loading…
Add table
Reference in a new issue