mardi 4 juin 2019

How to send value of a checkbox using Formik

I am making a formik form and every field sets and sends values correctly except my checkbox field. I can't really find good documentation on it so was wondering if anyone could help me.

My props to values formik function:

  mapPropsToValues: props => ({
    firstName: props.firstName || '',
    lastName: props.lastName || '',
    businessName: props.businessName || '',
    email: props.email || '',
    phone: props.phone || '',
    zipCode: props.zipCode || '',
    yearsInBusiness: props.yearsInBusiness || '',
    callBackTime: props.callBackTime || '',
    paymentServices: [],
    paymentProcessing: props.paymentProcessing || ''
  }),

And my input field.

 <CheckboxField
   type="checkbox"
   name="paymentProcessing"
   value={values.paymentProcessing}
   label="Payment Processing Equipment"
  />

I basically need the value of the checkbox field to equal to label if checked




Aucun commentaire:

Enregistrer un commentaire