From b787e46c7e4cbf16eb5df8c61fce091544dafa92 Mon Sep 17 00:00:00 2001 From: michaelschal <35957947-michaelschal@users.noreply.replit.com> Date: Mon, 8 Sep 2025 20:22:47 +0000 Subject: [PATCH] Fix issue preventing users from deleting numeric input values Corrected the numeric input onChange handler in Avoirs.tsx to properly handle empty string input and non-numeric values, allowing users to clear the input field. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 9fcf4b21-eb0c-4e53-a567-e2ce4a6ad869 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/9fcf4b21-eb0c-4e53-a567-e2ce4a6ad869/Ii96ETr --- client/src/pages/Avoirs.tsx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/client/src/pages/Avoirs.tsx b/client/src/pages/Avoirs.tsx index ff15463..8f36832 100644 --- a/client/src/pages/Avoirs.tsx +++ b/client/src/pages/Avoirs.tsx @@ -1361,9 +1361,21 @@ export default function Avoirs() { type="number" step="0.01" placeholder="Montant en euros (optionnel)" - {...field} value={field.value ?? ""} - onChange={(e) => field.onChange(e.target.value ? parseFloat(e.target.value) : undefined)} + onChange={(e) => { + const value = e.target.value; + if (value === "") { + field.onChange(undefined); + } else { + const num = parseFloat(value); + if (!isNaN(num)) { + field.onChange(num); + } + } + }} + onBlur={field.onBlur} + name={field.name} + ref={field.ref} />