add negative handler on amount field
This commit is contained in:
@ -158,8 +158,14 @@ const TransactionTopup = () => {
|
||||
<Input
|
||||
id="topupAmount"
|
||||
type="number"
|
||||
min={0}
|
||||
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>
|
||||
|
||||
Reference in New Issue
Block a user