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

166
Vistas
How can i get values of input sent to api on ok button of ant design modal?

I'm trying to implement a kind of table, which has an add button that opens a modal.

Inside the modal, I have the inputs that I want to update in the table, but using the ant design modal it has an ok button and a cancel button. How do I make the path to get the values? I'm having trouble understanding/writing this syntax. Can someone help me?

on the "onOk", i don't know how to write the function, tried creating a onSubmit(values) and console.log it but it doesn't show

Here's the code

    function showModal(nome,colunas) {
    setFormDisplay("");
    setModal(!modal);
    setFormName(nome);
    setFormColumns(colunas);
  }

  function cancelModal() {
    setFormDisplay("none");
    setModal(false);
    setFormName("");
    setFormColumns([]);
  }


    <>
      <div className="">
        <CardsHost posts={nomes} />
        
      </div>
      <Modal
        visible={modal}
        onOk={} 
        title="Novo Prontuário"
        onCancel={cancelModal}
        style={{display:`${formDisplay}`}}
        width={1000}
        
      >
      

      {formColumns.map((column,index) => (
        <>
          <div className="labelll">
            <label key={`label-${index}`}>{column.title}</label>

              {(column.key !=='proc' && column.key !== 'meds' ) 
                ?  <Input key={`input-${index}`} style={{ width: "61.3%" }} />
                :  (column.key == 'proc' ) ? <div className="pesquisa-input"><Demo /></div>
                :  <div className="pesquisa-input"><PageComponentMeds /> </div>
               }
               
            
              
           
            
          </div>

          

           {/*<div className="labelll">
            <label> Data de Atendimento</label>
            <DatePicker style={{ width: "61.3%" }} />
          </div>

          <div className="labelll">
            <label> Nota </label>
            <TextArea style={{ width: "61.3%" }} />
      </div> */}
        </>
      ))}
      </Modal>
    </>
  );
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The easiest way would be use to add a state variable for both of your input values. You can update them using the onChange callback provided by the antd components. On submit you use the state values to make your api call.

Make sure that you reset the variables on cancel and after a successful call.

about 4 years ago · Juan Pablo Isaza Denunciar
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