I've a form...

function modulename_myform($form, &$form_state)
        $form['my_ta'] = array(
            '#type' => 'textarea',
            '#resizable' => FALSE,
        $form['my_submit'] = array(
            '#type' => 'submit',
            '#input' => TRUE,
            '#value' => 'Submit',
            '#name' => 'sub_1',
            '#button_type' => 'submit',
        return $form;

My form couldn't submit any data... So I tried doing two variants...

/* Form Submit */
function modulename_myform_submit($form, &$form_state)
    drupal_set_message('Submitted Value @name',array('@name'=>$form_state['values']['my_ta']));

Output : Doesn't print anything and says value is null at that location...

/* Form Submit */
function modulename_myform_submit($form, &$form_state)
    drupal_set_message(t('Submitting values: @values', array('@values' => var_export($form_state['values']['my_ta'], TRUE))));

Output : Prints the Dump with proper values...

Why is that? It should be giving me the text entered in my_ta right? Please help me...

2 Answers 2


the first attempt doesn't contain t() function in set message function... hence it's failing...


The 1st would not work as it is neither default and nor explicitly defined against #submit. For first to work:

$form['#submit'] = array('modulename_myform_submit')

The 2nd should work.

If still it is not getting submitted then make sure the form is properly rendered and processes by drupal_get_form()

  • 1
    The submission handler is invoked, as it has the default name a submission handler should have. If that would be the problem, the submission handler would do nothing in both the cases. As the OP reported, in the first case the code is missing the call to t().
    – apaderno
    Commented Jun 30, 2011 at 23:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.