Difference between revisions of "Webforms"

From Stadm
Jump to navigationJump to search
Line 5: Line 5:
 
==Setup==
 
==Setup==
  
*Webform should be enabled, and in its module configuration settings, Webform-enabled content types should be set to Webform. The Default Email Values in this menu can be left as they are.
+
#Webform should be enabled, and in its module configuration settings, Webform-enabled content types should be set to Webform. The Default Email Values in this menu can be left as they are.
*Once the module is enabled, you can add a new webform by going to admin->content->Add Content->Webform.
+
#Once the module is enabled, you can add a new webform by going to admin->content->Add Content->Webform.
**On this page, you can set the title of the webform. The body field can be left blank.
+
##On this page, you can set the title of the webform. The body field can be left blank.
***Click URL Path Settings below the body and type the page name and path you would like the form to appear on
+
##Click URL Path Settings below the body and type the page name and path you would like the form to appear on
**On the next page you can add components to your webform
+
##On the next page you can add components to your webform
**Components are things like textareas, file upload forms, date fields etc.
+
##Components are things like textareas, file upload forms, date fields etc.
**These as well as their labels will appear on your form (except those with the type 'hidden')
+
##These as well as their labels will appear on your form (except those with the type 'hidden')
**Content in hidden fields is accessible by the form application, but not viewable or editable by the user.
+
##Content in hidden fields is accessible by the form application, but not viewable or editable by the user.
*For a contact form, you should add the following fields
+
#For a contact form, you should add the following fields
#To (fieldset) - This is an non-editable field that displays the name of the recipient
+
##To (fieldset) - This is an non-editable field that displays the name of the recipient
#From (textfield) - This is where the user will type their own name
+
##From (textfield) - This is where the user will type their own name
#Email (textfield) - This is where the user will type their own email
+
##Email (textfield) - This is where the user will type their own email
#Subject (textfield) - A subject can be added
+
##Subject (textfield) - A subject can be added
#Message (textarea) - This is where the message goes
+
##Message (textarea) - This is where the message goes
#To Email (hidden) - this will not be displayed on the form, but will retrieve the recipients email from the drupal database
+
##To Email (hidden) - this will not be displayed on the form, but will retrieve the recipients email from the drupal database
*Click the E-Mails link below the Webform tabs
+
#Click the E-Mails link below the Webform tabs
*Select "Component Value", and chose the field that you created for the recipients email ("To Email" in this example)
+
#Select "Component Value", and chose the field that you created for the recipients email ("To Email" in this example)
*Click Add
+
#Click Add
*The form is now set up. You can view it by navigating to the URL that you gave the form in step 4.
+
#The form is now set up. You can view it by navigating to the URL that you gave the form in step 2.

Revision as of 15:36, 16 August 2012


Out of the box, the Drupal Webform module provides a content type that builds a form on a page with several customizable elements including text, email and textarea for emailing content to a static email address configurable through the webform E-Mail settings in the Webform content type. Creating a contact form that sends emails to a variable address can be done using hook_form_alter.

Setup

  1. Webform should be enabled, and in its module configuration settings, Webform-enabled content types should be set to Webform. The Default Email Values in this menu can be left as they are.
  2. Once the module is enabled, you can add a new webform by going to admin->content->Add Content->Webform.
    1. On this page, you can set the title of the webform. The body field can be left blank.
    2. Click URL Path Settings below the body and type the page name and path you would like the form to appear on
    3. On the next page you can add components to your webform
    4. Components are things like textareas, file upload forms, date fields etc.
    5. These as well as their labels will appear on your form (except those with the type 'hidden')
    6. Content in hidden fields is accessible by the form application, but not viewable or editable by the user.
  3. For a contact form, you should add the following fields
    1. To (fieldset) - This is an non-editable field that displays the name of the recipient
    2. From (textfield) - This is where the user will type their own name
    3. Email (textfield) - This is where the user will type their own email
    4. Subject (textfield) - A subject can be added
    5. Message (textarea) - This is where the message goes
    6. To Email (hidden) - this will not be displayed on the form, but will retrieve the recipients email from the drupal database
  4. Click the E-Mails link below the Webform tabs
  5. Select "Component Value", and chose the field that you created for the recipients email ("To Email" in this example)
  6. Click Add
  7. The form is now set up. You can view it by navigating to the URL that you gave the form in step 2.