add negative handler on amount field
This commit is contained in:
@ -263,10 +263,16 @@ const TransactionDisbursement = () => {
|
|||||||
<label htmlFor="amount">Amount</label>
|
<label htmlFor="amount">Amount</label>
|
||||||
<span className="text-red-500">*</span>
|
<span className="text-red-500">*</span>
|
||||||
<Input
|
<Input
|
||||||
id="amount"
|
id="topupAmount"
|
||||||
type="number"
|
type="number"
|
||||||
|
min={0}
|
||||||
value={form.amount}
|
value={form.amount}
|
||||||
onChange={(e) => setForm({ ...form, amount: e.target.value })}
|
onChange={(e) => {
|
||||||
|
const value = Number(e.target.value);
|
||||||
|
if (value >= 0) {
|
||||||
|
setForm({ ...form, amount: String(value) });
|
||||||
|
}
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@ -158,8 +158,14 @@ const TransactionTopup = () => {
|
|||||||
<Input
|
<Input
|
||||||
id="topupAmount"
|
id="topupAmount"
|
||||||
type="number"
|
type="number"
|
||||||
|
min={0}
|
||||||
value={form.topupAmount}
|
value={form.topupAmount}
|
||||||
onChange={(e) => setForm({ ...form, topupAmount: e.target.value })}
|
onChange={(e) => {
|
||||||
|
const value = Number(e.target.value);
|
||||||
|
if (value >= 0) {
|
||||||
|
setForm({ ...form, topupAmount: String(value) });
|
||||||
|
}
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
Reference in New Issue
Block a user