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

136
Views
React Formik and Checkbox

I need to map dynamicaly on a array. This array can change with a search field and i need to know what checkbox are checked to send my data with a submit but i dont find the right way to do to check the checkbox with Formik. This is my code :

const initialValues = {
    checked: [],
  };

  const onSubmit = (values) => {
    console.log(values);
  };

<Formik onSubmit={onSubmit} initialValues={initialValues}>
          {({ values, handleSubmit }) => (
            <form
              onSubmit={handleSubmit}
              noValidate={true}
            >
              {Listing.map((Search, index) => {
                if (
                  Search.installationAddress.includes(
                    searchMeter
                  ) ||
                  Search.deviceId.includes(searchMeter)
                ) {
                  return (
                    <div
                      key={index}
                    >
                      <Checkbox
                        color="text.standard"
                        label={`${Search.installationAddress}`+" Compteur N° " +`${Search.deviceId}`}
                        type="checkbox"
                        name="checked"
                        value={{
                          contractAccountId:
                            Search.contractAccountId,
                          deviceId: Search.deviceId,
                        }}
                        size="large"
                      />
                    </div>
                  );
                }
              })}
              
              <Checkbox
                color="text.standard"
                label="I confirm"
                onChange={() => setValidationButton(!validationButton)}
                value=""
                checked={validationButton}
              />
              <Button
                type="submit"
                disabled={!validationButton}
              
              >
               ACTIVATE
              </Button>
            </form>
          )}
        </Formik>
about 4 years ago · Santiago Trujillo
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!