eZ Community » Learn » eZ Publish » Create a feedback form in eZ Publish...

Create a feedback form in eZ Publish 5 using ezforms-bundle

Monday 12 May 2014 3:33:49 pm

  • Currently 3 out of 5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Create a dedicated content

We want our form to be an editable eZ Publish content. We could rely on an existing content type like article or folder but we will create a dedicated form content type to make it more obvious to content editors. As a bonus, this new content type could later be used to create other forms than our feedback form. The new type can be created from the administration interface with an admin user account.

NB: This section is vanilla eZ Publish, everything will be done from the administration interface. As the administration interface still relies on legacy stack (eZPublish 4.x), the names of the concepts are the old ones (Content type = Class, Content = Object, Location = Node).

Content Type creation

  1. Log into http://ezforms-tutorial.localhost/ezdemo_site_admin/
  2. Navigate to Setup > Classes, click on the Content class group and click the New class button a the bottom-right of the page
  3. Enter the following values: 
    • Name: Form
    • Identifier: form
    • Object name pattern: <title>
    • URL alias name pattern: <title>
  4. Add the following field definitions:
    • Title  
      • Identifier: title
      • Type: Text line
      • Options: Required, searchable
    • Introduction message
      • Identifier: intro
      • Type: XML block
      • Options: Searchable
    • Confirmation message
      • Identifier: confirm
      • Type: XML block
      • Options: Required
  5. Click OK to save your content type

You can of course add the fields you want but these are the minimum required to achieve our goal.

Content creation

  1. Get back to content structure and click on your Home page in the tree
  2. In the subitems section, click on Create New > Form
  3. Enter the contents:
    • Title: Feedback
    • Introduction message: Hi, if you'd like to share some thoughts about our website, please fill in this form
    • Confirmation: Thank you very much for your feedback!
  4. Click on Send for publishing

Your content should now be visible in your home page's subitems list. Click on it and then on the Details link. You should be see your object's remote id, which is a random generated identifier (mine is 09fc43d390f64e35a3f51fdbbe980d66). We'll soon use this identifier to map our newly created content with a Symfony form type.

 

 

 

Printable

Printer Friendly version of the full article on one page with plain styles

Author(s)

Proudly Developed with from