Share » Learn » eZ Publish » How to Create eZ Publish Forms

How to Create eZ Publish Forms

Wednesday 19 December 2007 11:44:00 am

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

The first step in creating the membership application form is to create a class for the object that will collect the information from visitors.

To do this, log in to the Administration Interface and click on the Setup tab. In the left menu, click the Classes link:

Click on the Classes link

Then, in the Class groups window, click the Content link. Our form will appear in the Content branch of the site's node tree and thus be under this group:

"Content" class group

You are then presented with a list of all the existing classes in the Content class group. At the bottom of this list, click the New class button:

New class button

This will then display the Class edit interface:

Class edit interface

In our example, the name of the form is “Membership Application Form”, its identifier is “membership_application_form” and the object name pattern is “<form_name>”.

To add an attribute, select the datatype from the dropdown list at the bottom of the page and click the adjacent Add attribute button. Then, fill in the necessary information for the attribute. Repeat this in order to add subsequent attributes:

Add attribute

Note that the attributes that will collect information (through form fields presented to the visitor) need to have the Information collector checkbox marked:

Information collector checkbox

Rather than repeating the explanation of the steps to add each attribute, the information for all the attributes is summarized in the table below:

Name Identifier Datatype Required Searchable Information collector
Form Name form_name Text line Yes Yes No
Form Introduction form_introduction XML block No Yes No
Given Name given_name Text line Yes No Yes
Family Name family_name Text line Yes No Yes
Date of Birth date_of_birth Date Yes No Yes
Contact Phone Number contact_phone_number Text line Yes No Yes
Email Address email_address E-mail Yes No Yes
Postal Address postal_address Text block Yes No Yes
Please send me information about the club's tennis tournaments option_play_in_tournaments Checkbox No No Yes
Please send me information about tennis classes and professional coaching option_classes_and_coaching Checkbox No No Yes
I would like to receive the monthly club newsletter by email option_club_newsletter Checkbox No No Yes
Please keep me informed about the club's social events and competitions option_social_events_
competitions
Checkbox No No Yes
Can we help by answering any questions? other_questions Text block No No Yes
Membership Coordinator E-mail Address membership_coordinator_email_
address
E-mail Yes No No

Re-organizing class attributes

Sometimes, when creating a class, it is useful to change the order of the attributes. This determines the order of attributes presented when a user creates an object (thus creating the form). If a custom template to display the form is not used, then this order also determines the order of the fields when the object / form is viewed on the front-end of the site. The elements highlighted below can be used to re-order attributes.

Reorganize class attributes

There are two ways to re-order attributes:

  • Use the arrow buttons to shift the current attribute up or down one position in the class attribute list; or
  • Change the attribute numbers, which can be faster than moving attributes with the arrow keys if you need to re-order many attributes at once.

When using the first method, the page will automatically reload with the attribute order changed. However, if the attributes are renumbered using the second method, you must click the Apply button (or OK button if you are finished editing the class) to store the changes.

Saving the new class

Once you have entered all the relevant attribute information, click the OK button to add the new class.

The next step is to modify the appropriate INI settings in order to configure the form.

36 542 Users on board!

Tutorial menu

Printable

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

Author(s)