I want to take the content of a textarea and process it with a php function in my module when a user clicks submit in a form.

How do I do this? There doesn't seem to be a #callback attribute to set for the submit button according to the form api, or have I missunderstood?


I think you need to use a submit handler in hook_form_alter

['#submit'][] = 'callback_form_submit';

then in the callback you can manipulate the textarea

function callback_form_submit($form, &$form_state) {
// find the textarea value in $form_state['values]

So you can't add it directly in the form builder function?

Oh, and also I have the function _molmeth_add_form_submit() which should be run after the callback function if certain requirements are met. Will this be possible to configure in the callback function or somewhere else?

Problem is solved.