Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

202
Views
antd: Force an Input field to Uppercase

i want the text to be upeercase with ant design, i tried this:

<Form form={form} layout='vertical' autoComplete='off'>
    <Form.Item
      name='apellido_empleado'
      label='Apellidos'
      rules={[
        {
          required: true,
          message: 'Por favor ingrese los apellidos',
          transform: (v) => v.toUpperCase(),
        },
      ]}>
      <Input />
    </Form.Item>

it seems that the property transform only work for validations.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can use onInput event to transform text to uppercase.

const [form] = Form.useForm<{ apellido_empleado: string }>();
return (
    <>
        <Form form={form} layout='vertical' autoComplete='off' sub>
            <Form.Item
                name='apellido_empleado'
                label='Apellidos'
                rules={[
                    {
                        required: true,
                        message: 'Por favor ingrese los apellidos'
                    },
                ]}>
                <Input onInput={e => e.target.value = e.target.value.toUpperCase()} />
            </Form.Item>
        </Form>
        <Button onClick={() => console.log(form.getFieldValue('apellido_empleado'))}>Print value</Button>
    </>
);

In typescript (e.target as HTMLInputElement).value

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!