Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

143
Visualizações
How can i verify is input / dropdown empty?

I made dynamic form items. I taking datas from SQL Server and making inputs like :

 const GenerateField = (val, obj = {}) => { 
    switch (val.CategoryProperty.DataTypeId) {
      case 1:
        return (
          <Form.Item
            name={val.CategoryProperty.Name}
            required
            label={val.CategoryProperty.Name}
          >
            <Input
              name={val.CategoryProperty.Name}
              onChange={(e) =>
                updateDynamicForm(e.target.value, val.CategoryProperty.Id)
              }
            />
          </Form.Item>
        );
      case 2:
        return (
          <Form.Item
            required
            label={val.CategoryProperty.Name}
            name={val.CategoryProperty.Name}
          >
            <Select
              name={val.CategoryProperty.Name}
              className="text-left"
              onChange={(e) => updateDynamicForm(e, val.CategoryProperty.Id)}
            >
              {val.CategoryProperty.CategoryPropertyDetails.map((x) => {
                return (
                  <Select.Option key={x.Id} value={x.Id}>
                    {x.Name}
                  </Select.Option>
                );
              })}
            </Select>
          </Form.Item>
        );
      case 3:
        let GroupList = [];
        val.CategoryProperty.CategoryPropertyDetails.forEach((element) => {
          const newRow = {
            label: element.Name,
            value: element.Id,
          };
          GroupList.push(newRow);
        });
        const onChange = (checked) => {
          updateDynamicForm(checked, val.CategoryProperty.Id);
        };
        return (
          <Form.Item
            valuePropName="checked"
            required
            label={val.CategoryProperty.Name}
            name={val.CategoryProperty.Name}
          >
            <Checkbox.Group onChange={onChange} options={GroupList}>
              Test CheckBox
            </Checkbox.Group>
          </Form.Item>
        );

      default:
        break;
    }
  };

So as you can understand , Name tag always changing dynamicly. And my form is wizard form. So on my screen only have 2 question in 1 page. When i click next other 2 comes like that. So how can i verify and put rules to my dynamic input / Dropdowns ? For example : It cant be empty or It cant be lower than 2nd input or you must choose a dropdown option. How can i make it ? On my opinion i can verify with next button but my name tags always changing so i cant find that input / Dropdowns and check values. Thanks for responses!

An Image from my project : https://prnt.sc/1y30ni2 ( I need verify with Next ( "İleri" ) button. )

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda