Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

309
Vistas
React Antd Input url validation

am validation the format of url and also am sending backed request if that url doesn't already taken, and if it is taken i make the validation to error if it is not taken i will make it success the problem is when i make it success event the url format is wrong it shows as it is success, i know i have to check if the format is correct and the api return true for the url not taking by other so how can i get the current status of the antd validation this is my code

     [![<Form.Item
              name="websiteUrl"
              className="max-w-sm"
              validateStatus={validationStatus}
              hasFeedback
              rules={\[
                {
                  required: true,
                  type: 'url',
                  message:
                    'Insert a Valid website URL (make sure to include http/https)',
                },
                // {
                //   pattern: new RegExp('^(ftp|http|https)://\[^ "\]+$'),
                // },
                ({ getFieldValue }) => ({
                  async validator(rule, value) {
                    if (value === '') {
                      return setValidationStatus('error');
                    } else {
                      setValidationStatus('validating');
                      await checkWebsiteUrlApi(String(value).trim())
                        .then((response) => {
                          if (response) {
                            setValidationStatus('error');
                            return Promise.reject(
                              new Error('URL already exits!')
                            );
                          } else {
                           
/* this is causing the problem before is set it to success i also have to check if the url is correct format before setting it to success */
setValidationStatus('success');
                            return Promise.resolve();
                          }
                        })
                        .catch((error) => {
                          setValidationStatus('error');
                          return Promise.reject(new Error(error?.message));
                        });
                    }
                  },
                }),
              \]}
            >
              <Input
                name="websiteUrl"
                defaultValue={websiteUrl}
                onChange={(e) => setWebsiteUrl(e.target.value)}
                className="max-w-sm"
              />
            </Form.Item>][1]][1]
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda