Validate and submit function for my fom aren't working So I'm trying to create a form with a validate and submit function, here is my code :

the form :

    function custom_form() {
      $form = array();
      $form['field1'] = array(
        '#type' =&gt; 'textfield',
        '#title' =&gt; t('Field1'),
        '#required' =&gt; TRUE
      );
      $form['field2'] = array(
        '#type' =&gt; 'textfield',
        '#title' =&gt; t('Field2'),
        '#required' =&gt; TRUE
      );
      $form['field3'] = array(
        '#type' =&gt; 'textfield',
        '#title' =&gt; t('Field3'),
        '#required' =&gt; TRUE
      );
      $form['submit'] = array(
        '#type'=&gt;'submit',
        '#value'=&gt;t('Submit')
      );
      return $form;
    }


the validate function :

    function custom_form_validate($form, &amp;$form_state) {
      if(empty($form_state['values']['field1']))
        form_set_error('field1','field1 is empty.');
      else if(empty($form_state['values']['field2']))
        form_set_error('field2','field2 is empty.');
      else if(empty($form_state['values']['field3']))
         form_set_error('field3','field3 is empty.');
    }


and the submit function :

    function custom_form_submit($form, &amp;$form_state) {
       drupal_set_message("Form has been submitted");
    }


But when I click on submit nothing appends, do I forget something ?

EDIT :
Here is all my code (I'm using shortcode module to create a custom shortcode in order to show my form)

    function custom_form_info() {
      $shortcodes['form'] = array(
        'title' =&gt; t('Link form'),
        'description' =&gt; t('A simple form.'),
        'process callback' =&gt; 'custom_shortcode_form',
      );
      return $shortcodes;
    }

    function custom_shortcode_form($attrs, $text) {
      $form = drupal_get_form('custom_form');
      $attrs = drupal_render_children($form);
      return $attrs;
    }
Add the following lines to your custom_form function:

$form['#validate'][] = 'custom_form_validate';
$form['#submit'][] = 'custom_form_submit';


Clear the cache afterwards and you will be good