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

158
Visualizações
how to use from radio button instead of submit react?

I have a form I would like to instead of using the button to go to the next step, Use the radio button.

Is it possible to do this in Next js?

import React, { useState } from "react";
import { Form, Card, Button } from "react-bootstrap";
import mentorStyles from "../../../../styles/users/pages/MentorReserve.module.css";

const Steptwo = ({ nextStep }) => {
  const [validated, setValidated] = useState(false);

  const [formData, setFormData] = useState({
    time: "",
  });

  const handleSubmit = (event) => {
    const form = event.currentTarget;

    if (form.checkValidity() === false) {
      event.preventDefault();
      event.stopPropagation();
      setValidated(true);
    } else {
      event.preventDefault();
      nextStep();
    }
  };

  return (
    <>
      <Form noValidate validated={validated} onSubmit={handleSubmit}>
        <div className="row row-cols-5 w-atuo ">
          <div className="col">
            <div className="row row-cols-1">
              <div
                className={`col d-flex bg-success rounded text-white h-75-px w-75 align-items-center justify-content-center ${mentorStyles.h_75_px}`}
              >
                <span className="text-center">1 مهر 1401</span>
              </div>
              <div
                className={`col d-flex mt-1 rounded border w-75 align-items-center justify-content-center ${mentorStyles.h_75_px} ${mentorStyles.hover_border_radio}`}
              >
                <label
                  className={` ${mentorStyles.container}`}
                >
                  11:00 ق.ظ
                  <input
                    type="radio"
                    name="time"
                    onChange={(event) =>
                      setFormData({
                        ...formData,
                        time: event.target.value,
                      })
                    }
                    value={formData.time}
                  />
                  <span className={` ${mentorStyles.checkmark}`}></span>
                </label>
              </div>
               ...
      </Form>
          ...
    </>
  );
};

export default Steptwo;

You can see the photo of the stage below

enter image description here

I hope someone can help me :)

And

I hope you understand what I mean :)

If someone else asked this answer before me and got an answer, please link it.

almost 4 years ago · Santiago Trujillo
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