From 230c53fc457df8c3c539bfa2152f801c7226737b Mon Sep 17 00:00:00 2001 From: Gykes Date: Tue, 3 Sep 2024 20:29:43 -0700 Subject: [PATCH] Removing White Space from InputFields. I only added it in to `` Reason being is, if I'm not mistaken, the other fields aren't really sortable anyway so it shouldn't affect sorting. People should still be able to add following and trailing spaces in things like description, Piercings, Tattoos, etc. Personally I see no reason to remove that unless there is something I am missing. --- ui/v2.5/src/utils/form.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ui/v2.5/src/utils/form.tsx b/ui/v2.5/src/utils/form.tsx index 40fedc7bf20..731d3a5a53d 100644 --- a/ui/v2.5/src/utils/form.tsx +++ b/ui/v2.5/src/utils/form.tsx @@ -113,6 +113,12 @@ export function formikUtils( value = ""; } + // trimming leading and trailing spaces from inputs + const handleBlur = (e: React.ChangeEvent) => { + formik.setFieldValue(field, e.target.value.trim()); + formik.handleBlur(e); + }; + let control: React.ReactNode; if (type === "checkbox") { control = ( @@ -141,6 +147,7 @@ export function formikUtils( className="text-input" placeholder={placeholder} {...formikProps} + onBlur={handleBlur} value={value} isInvalid={!!error} />