tabledrag submit - $form_state missing values I have built a draggable table using this tutorial (halfway down page is the Drupal 8 code):

https://www.drupal.org/node/1876710

In the submit function I would like to look through all the rows and create an array for each row. I am using the following code:

foreach ($form_state-&gt;getValues(['mytable','rows']) as $tablerow) {


And then running db_update on each item using this:

$tablerow['label']


But this returns an error "undefined index". Is there something wrong with the foreach line?

UPDATE: My table is generated using this code:

  foreach ($entities as $id =&gt; $entity) {
    // TableDrag: Mark the table row as draggable.
    $form['mytable'][$id]['#attributes']['class'][] = 'draggable';
    // TableDrag: Sort the table row according to its existing/configured weight.
    $form['mytable'][$id]['#weight'] = $entity-&gt;get('weight');

    // Some table columns containing raw markup.
    $form['mytable'][$id]['label'] = array(
      '#plain_text' =&gt; $entity-&gt;label(),
    );
    $form['mytable'][$id]['id'] = array(
      '#plain_text' =&gt; $entity-&gt;id(),
    );

    // TableDrag: Weight column element.
    $form['mytable'][$id]['weight'] = array(
      '#type' =&gt; 'weight',
      '#title' =&gt; t('Weight for @title', array('@title' =&gt; $entity-&gt;label())),
      '#title_display' =&gt; 'invisible',
      '#default_value' =&gt; $entity-&gt;get('weight'),
      // Classify the weight element for #tabledrag.
      '#attributes' =&gt; array('class' =&gt; array('mytable-order-weight')),
    );

    // Operations (dropbutton) column.
    $form['mytable'][$id]['operations'] = array(
      '#type' =&gt; 'operations',
      '#links' =&gt; array(),
    );
    $form['mytable'][$id]['operations']['#links']['edit'] = array(
      'title' =&gt; t('Edit'),
      'url' =&gt; Url::fromRoute('mymodule.manage_edit', array('id' =&gt; $id)),
    );
    $form['mytable'][$id]['operations']['#links']['delete'] = array(
      'title' =&gt; t('Delete'),
      'url' =&gt; Url::fromRoute('mymodule.manage_delete', array('id' =&gt; $id)),
    );
  }


I have run dpm($form_state-&gt;getValue(['mytable','2'])); on submit for each of the rows, but only the operations and weight column values appear in $form_state. How do I get the id and label columns to appear?
The answer is quite simple - markup doesn't make it into $form_state. Place the item id ($entity->ref in the below code) in a textfield or number field instead and use the following to hide and disable it (not sure if disabling is necessary):

    $form['mytable'][$id]['label'] = array(
    //'#plain_text' =&gt; $entity-&gt;ref,
    '#type' =&gt; 'number',
    '#title' =&gt; "",
    '#default_value' =&gt; $entity-&gt;ref,
    '#disabled' =&gt; TRUE,
    '#access' =&gt; FALSE,