- Something
- Wednesday, August 8th, 2007 at 3:09:37am MDT
- <?php
- // $Id$
- /**
- * Implementation of hook_menu().
- */
- function subdomainwizard_menu($may_cache) {
- $items = array();
- if ($may_cache) {
- $items[] = array(
- 'path' => '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'),
- '#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)));
- }
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.
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.