diff --git a/src/hooks/use-form.tsx b/src/hooks/use-form.tsx index fa4a6df71..3978540d4 100644 --- a/src/hooks/use-form.tsx +++ b/src/hooks/use-form.tsx @@ -70,10 +70,20 @@ export const useForm = ({ const handleInputChange = (key: keyof T) => (event: React.ChangeEvent) => { - const value = + const nameRegex = /[^a-zA-Z\u0400-\u04FF]/g + + let value = event.target.type === 'checkbox' ? event.target.checked : event.target.value + + if ( + (key === 'firstName' || key === 'lastName') && + typeof value === 'string' + ) { + value = value.replace(nameRegex, '') + } + setData((prev) => { const newData = { ...prev,