'subdomainwizard', 'title' => t('View the form'), 'callback' => 'subdomainwizard_page', 'access' => TRUE ); } return $items; } / /** * Called when user goes to example.com/?q=subdomainwizard' */ function subdomainwizard_page() { $output = t('Are you ready to create your subdomain?'); // Return the HTML generated from the $form data structure. $output .= drupal_get_form('subdomainwizard_nameform'); return $output; } function subdomainwizard_nameform() { $form['user_name'] = array( '#title' => t('Subdomain Name'), '#name' => 'subdomain', '#type' => 'textfield', '#description' => t('Please enter your subdomain.'), ); $form['submit'] = array( '#type' => 'submit', '#value' => t('Submit') ); return $form; } /** * Validate the form */ function subdomainwizard_nameform_validate($form_id, $form_values) { if ($form_values['user_name'] == 'King Kong') { // We notify the form api that this field has failed validation. form_set_error('user_name', t('King Kong is not allowed to use this form.')); } } /** * Handle post-validation form submission. */ function subdomainwizard_nameform_submit($form_id, $form_values) { $name = $form_values['user_name']; drupal_set_message(t('Thanks for filling out the form, %name', array('%name' => $name))); }