mirror of
https://github.com/lnbits/lnbits.git
synced 2025-03-17 21:31:55 +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
@ -330,6 +330,7 @@
|
|||||||
:min="receive.minMax[0]"
|
:min="receive.minMax[0]"
|
||||||
:max="receive.minMax[1]"
|
:max="receive.minMax[1]"
|
||||||
:readonly="receive.lnurl && receive.lnurl.fixed"
|
:readonly="receive.lnurl && receive.lnurl.fixed"
|
||||||
|
inputmode="numeric"
|
||||||
></q-input>
|
></q-input>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
<q-separator></q-separator>
|
<q-separator></q-separator>
|
||||||
@ -355,6 +356,8 @@
|
|||||||
:min="receive.minMax[0]"
|
:min="receive.minMax[0]"
|
||||||
:max="receive.minMax[1]"
|
:max="receive.minMax[1]"
|
||||||
:readonly="receive.lnurl && receive.lnurl.fixed"
|
:readonly="receive.lnurl && receive.lnurl.fixed"
|
||||||
|
error-message="Not a valid amount"
|
||||||
|
:error="!isValid"
|
||||||
>
|
>
|
||||||
</q-input>
|
</q-input>
|
||||||
<div class="col-2 self-end">
|
<div class="col-2 self-end">
|
||||||
|
@ -97,6 +97,17 @@ window.WalletPageLogic = {
|
|||||||
.formatCurrency(0, this.receive.unit)
|
.formatCurrency(0, this.receive.unit)
|
||||||
.replace(/[\d.\s]/g, '')
|
.replace(/[\d.\s]/g, '')
|
||||||
.trim()
|
.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: {
|
methods: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user