Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Miscellany
Wednesday, August 8th, 2007 at 4:16:23am MDT 

  1. <?php
  2. // $Id$
  3.  
  4. /**
  5.  * Implementation of hook_menu().
  6.  */
  7.  function subdomainwizard_menu($may_cache) {
  8.    $items = array();
  9.    if ($may_cache) {
  10.    $items[] = array(
  11.    'path' => 'subdomainwizard',
  12.    'title' => t('View the form'),
  13.    'callback' => 'subdomainwizard_page',
  14.    'access' => TRUE
  15.    );
  16. }
  17. return $items;
  18. }
  19. /
  20. /**
  21.  * Called when user goes to example.com/?q=subdomainwizard'
  22.  */
  23. function subdomainwizard_page() {
  24.   $output = t('Are you ready to create your subdomain?');
  25.  
  26.   // Return the HTML generated from the $form data structure.
  27.   $output .= drupal_get_form('subdomainwizard_nameform');
  28.   return $output;
  29.   }
  30.  
  31.   function subdomainwizard_nameform() {
  32.   $form['user_name'] = array(
  33.   '#title' => t('Subdomain Name'),
  34.   '#name' => 'subdomain',
  35.   '#type' => 'textfield',
  36.   '#description' => t('Please enter your subdomain.'),
  37.   );
  38.  
  39.   $form['submit'] = array(
  40.   '#type' => 'submit',
  41.   '#value' => t('Submit')
  42.   );
  43.   return $form;
  44. }
  45.  
  46. /**
  47. * Validate the form
  48. */
  49.  
  50. function subdomainwizard_nameform_validate($form_id, $form_values) {
  51.   if ($form_values['user_name'] == 'King Kong') {
  52.   // We notify the form api that this field has failed validation.
  53.   form_set_error('user_name', t('King Kong is not allowed to use this form.'));
  54.   }
  55.   }
  56.  
  57.   /**
  58.   * Handle post-validation form submission.
  59.   */
  60.   function subdomainwizard_nameform_submit($form_id, $form_values) {
  61.   $name = $form_values['user_name'];
  62.   drupal_set_message(t('Thanks for filling out the form, %name',
  63.     array('%name' => $name)));
  64.         }

advertising

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

worth-right
worth-right
fantasy-obligation