In a custom form I created a table element:
// Table results.
$form['table'] = [
'#type' => 'table',
'#header' => $header,
'#rows' => $rows,
'#attributes' => ['id' => 'table-results'],
'#empty' => t('No results.'),
'#prefix' => '<div id="ajax-table-results">',
'#suffix' => '</div>'
];
This table is ajaxified and updated when I click on a specific button.
I need to get the output HTML of this table in another function. If I use a dpm($form_state->getValue('table')); I get an empty array. Yet, the other values (of other fields) are accessible in the $form_state.
// My second function
public function secondfunction(array $form, FormStateInterface $form_state) {
dpm($form_state->getValue('table')); // -> empty value...
dpm($form_state->getValue('textfield')); // I get a value
}
What do I change in my code to solve this problem?