How to get a form to submit: a possibly stupid question. Why won't this form submit?

$form['foo'] = array(
    '#type' =&gt; 'textfield',
);
$form['submit'] = array(
    '#type' =&gt; 'submit',
    '#value' =&gt; 'Submit',
);


if I add the following

$form['#submit'][] = 'my_form_submit';


and a submit function:

function my_form_submit($form, &amp;$form_state){
  dd('Submit ran');
}


The debug statement is never called. What am I doing wrong?
Actually the submit handler name should be the form function name with _submit.

So in this case: my_form() returns the form, and my_form_submit($form, &amp;$form_state) is automatically the submit handler. This also works for _validate.

See the Examples project for some working code. It has a submodule called form_example.