How to access form elements in table via getValue()? I'm trying to do so using array indices. Say, we have

$form['mytable'] = array(
'#type' =&gt; 'table',
'#header' =&gt; array(t('a'), t('b')));

$form['mytable'][1]['a'] = array(
'#type' =&gt; 'textfield',
'#required' =&gt; true));

$form['mytable'][1]['b'] = array(
'#type' =&gt; 'textfield',
'#required' =&gt; true));


What am I doing: $form_state-&gt;getValue('mytable[1][b]');, and it's not working. And how to pass such a field to setErrorByName?
You can access $form_state values like below

$values = $form_state-&gt;getValues();

If you are printing $values then you will get 

Array
(
    [mytable] =&gt; Array
        (
            [1] =&gt; Array
                (
                    [a] =&gt; Value of a
                    [b] =&gt; Value of b
                )

        )
)


setErrorByName() function can be used while validating the elements.