Checkbox value always 0 in custom submit handler I have a single checkbox field (not checkboxes) in a custom form, when I try to get the value in a submit handler the value is always 0 whether it's selected or not.
  /**
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state) {

    $form['item_specifics'] = [
      '#type' =&gt; 'checkbox',
      '#title' =&gt; t('Sync item specifics'),
      '#attributes' =&gt; [
        //define static name and id so we can easier select it
        // 'id' =&gt; 'select-colour',
        'name' =&gt; 'field_item_specifics',
      ]
    ];

    $form['fieldset_item_specifics'] = [
      '#type' =&gt; 'fieldset',
      '#title' =&gt; $this-&gt;t('Item Specifics'),
      '#attributes' =&gt; [
        //define static name and id so we can easier select it
        'class' =&gt; ['form-wrapper', 'js-form-wrapper'],
      ],
      '#states' =&gt; [
        //show this textfield only if the radio 'other' is selected above
        'visible' =&gt; [
          //don't mistake :input for the type of field. You'll always use
          //:input here, no matter whether your source is a select, radio or checkbox element.
          ':input[name=&quot;field_item_specifics&quot;]' =&gt; ['checked' =&gt; TRUE],
        ],
      ],
    ];

    $form['submit'] = [
      '#type' =&gt; 'submit',
      '#value' =&gt; $this-&gt;t('Sync'),
    ];

    return $form;
  }



  /**
   * {@inheritdoc}
   */
  public function submitForm(array &amp;$form, FormStateInterface $form_state) {

    dpm($form_state-&gt;getValue('item_specifics'));

  }


}

The output of dpm() is always 0, if I dpm() form state then the values array always has the checkbox value as 0.
try this, it is work with me just change name to item_specifics
  /**
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state) {

    $form['item_specifics'] = [
      '#type' =&gt; 'checkbox',
      '#title' =&gt; t('Sync item specifics'),
      '#attributes' =&gt; [
        //define static name and id so we can easier select it
        // 'id' =&gt; 'select-colour',
        'name' =&gt; 'item_specifics',
      ]
    ];

    $form['fieldset_item_specifics'] = [
      '#type' =&gt; 'fieldset',
      '#title' =&gt; $this-&gt;t('Item Specifics'),
      '#attributes' =&gt; [
        //define static name and id so we can easier select it
        'class' =&gt; ['form-wrapper', 'js-form-wrapper'],
      ],
      '#states' =&gt; [
        //show this textfield only if the radio 'other' is selected above
        'visible' =&gt; [
          //don't mistake :input for the type of field. You'll always use
          //:input here, no matter whether your source is a select, radio or checkbox element.
          ':input[name=&quot;item_specifics&quot;]' =&gt; ['checked' =&gt; TRUE],
        ],
      ],
    ];

    $form['submit'] = [
      '#type' =&gt; 'submit',
      '#value' =&gt; $this-&gt;t('Sync'),
    ];

    return $form;
  }



  /**
   * {@inheritdoc}
   */
  public function submitForm(array &amp;$form, FormStateInterface $form_state) {

    dpm($form_state-&gt;getValue('item_specifics'));

  }


}