tutorial07.rst 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. Tutorial Part 7: Forms & Contact Pages
  2. ======================================
  3. Now we need a way for our customers to contact us. We could just make a simple
  4. web page with our address, phone number, and email, but we want to make some forms
  5. that specify what our customers are looking for. Good thing there is a special page type
  6. just for forms!
  7. Adding a Form page to your site
  8. -------------------------------
  9. Just like before, we will go to the admin to make a new page under Home page. This time we are
  10. going to select **Form** for our page type. This is what a new Form page looks like:
  11. .. figure:: img/tutorial_new_form_page.png
  12. :alt: A new Form page.
  13. A new Form page ready for us to build.
  14. Creating the Form page
  15. ----------------------
  16. 1. Give your form a name.
  17. 2. Add a cover image if you want to include one.
  18. 3. Begin adding your fields. Select the **Add Form Fields**.
  19. 4. **Label** and **Field Type** are required, while the others are optional.
  20. 5. Make a field required or not. Some fields that should be required are Name, Phone, Email, and Message.
  21. 6. The **Field Types** available include: Text, Choice, Date & Time, File Upload, and Other.
  22. 7. For fields like Name, you would choose **single-line text**.
  23. 8. For fields like Message, you would choose **multi-line text.**
  24. 9. Custom field types such as **Email** and **URL** are available.
  25. 10. After you build the Form Fields, you can add more page content.
  26. 11. In **Form Settings**, you can select a Thank You page (if you've made one).
  27. 12. Choose the **Button Text** and **Button Style**.
  28. 13. In **Form Submissions**, add the email address (or addresses) where you want the submissions to go. You can also add a prepared subject line here.
  29. 14. Save and/or publish the form.
  30. .. figure:: img/tutorial__form_edit.png
  31. :alt: Our form with fields.
  32. A Form page with fields and settings.
  33. Then this is what the form looks like on the frontend:
  34. .. figure:: img/tutorial_form_published.png
  35. :alt: A form that has been published.
  36. Our published form page.
  37. For practice, make a few more forms. We probably need some Forms for General Inquiries,
  38. Career Interest, Special Event Requests, etc.
  39. Setting up Confirmation Emails
  40. ------------------------------
  41. Confirmation emails would be a good way to provide great customer service. So, we have decided to also add a Confirmation
  42. email after someone fills out the Custom Cupcake Order form. Scroll down to the last field on the Form Page in editor
  43. mode for the **Confirmation Emails** section.
  44. Our From Address will be our email address that is designated for orders with a BCC to our bakery owner. We've added the
  45. subject line "Order Received!" and a message that says "Thank you for your order! We have received it and will contact
  46. you within 24 hours for more details and to arrange payment!"
  47. Confirmation Emails uses Django template language and HTML for best results. To learn more, read :ref:`confirmation-emails`.
  48. .. note::
  49. By default when running locally, confirmation emails are not sent, but are
  50. instead printed to the command line.
  51. Creating our Contact Us page
  52. ----------------------------
  53. You could use a single form as your Contact Us page, but we want to show you that you can add several forms
  54. to your Contact Us page. We are going to add three forms to our contact page.
  55. First, make a Web Page under Home page that has the title of Contact Us. Add a title, cover image, and a Responsive
  56. Grid Row. Once we get to the content blocks, select the Text block and add the titles of your web forms, then link to
  57. their pages. You can continue to add content to this page as you'd like. This is what we did:
  58. .. figure:: img/tutorial_contact_us_edit.png
  59. :alt: Edit mode for our Contact Us page.
  60. The edit screen for our Contact Us page.
  61. Publish the page and see the result. This is how our Contact Us page looks so far:
  62. .. figure:: img/tutorial_contact_us_published.png
  63. :alt: The published Contact Us page.
  64. The published Contact Us page. We will customize the style later on.