Module Development

Creating, Submitting and Validating a Simple Form for Drupal 7

Check your version

This tutorial covers a topic in Drupal 7 which may or may not be the version you're using. We're keeping this tutorial online as a courtesy to users of Drupal 7, but we consider it archived.

Alternate resources

Sprout Video

This videos goes through the process of creating a form with Drupal Forms API that is single select list that has a validation, submission and redirect functionality.


Their is a typo in the code displayed in the video. The function

function form_fun_cake(&$form_state)

is missing the $form paramater and should instead be

function form_fun_cake($form, &$form_state)

Curious about when you're supposed to translate "title" and when you should leave it alone? Here's the answer: You don't need to translate the 'title' attribute of an array that defines a menu item because Drupal will take care of that automatically. In fact, you shouldn't translate those as they'll end up getting double translated if you do. This is because Drupal end's up using this string of text in a number of different ways some of which don't actually need to be translated and others that do like for example when it's the title of a page or the text of a link in the menu system. The #title (and #description) property for elements in Form API array however are your responsibility to translate.