[eZ publish] (Tranfer) Build a form use the information collector 4

Submission confirmation template

The submission confirmation template for the form is loaded after the user clicks the Send formbutton (and after the system has validated the information in the form- for example, if an invalid email addresses is typed into thecorresponding field, the form will reload with a warning). It acts asan acknowledgment that the site has received the form information.

For example, suppose our form was filled in as follows:

Application form filled

From the collect.ini.append.phpfile, eZ Publish knows it is working with an information collectionform called “membership_application_form”. After the user clicks the Send form button, eZ Publish looks for the corresponding template in the /content/collectedinfo/design directory.

In this case, we will use form.tpl (the template for the default eZ Publish feedback form) in that directory as a model. Our new template is placed in /extension/ezwebin/design/ezwebin/templates/content/collectedinfo/ 

On the front-end of the site, this is what is displayed after the form is submitted:

Submission confirmation page

Email template for form results

Upon form submission, we have also specified (in collect.ini.append.php) that eZ Publish send an email. This email is generated from a template named membership_application_form.tpl in this folder:

/extension/ezwebin/design/ezwebin/templates/content/collectedinfomail/

In this example, the existing eZ Publish feedback.tpl template can be used as a model. 

Note the"membership_coordinator_email_address" elements, which specify therecipient email address. In this case, they are referencing theidentifier for the “membership_coordinator_email_address” attribute(the contents of which will be specified in the next section when wecreate the form object) of the Membership Application Form object.

Up until now, we have beenconfiguring the membership application form, but we have not yetcreated the object! To do so, first click the Content structure tab of the Administration Interface.

In our case, we will place theform directly beneath the top-level node of the Content branch;therefore, we do not have to navigate any further in the AdministrationInterface. In the Sub items window at the bottom of the page (if it is missing, click the Sub items switch underneath the main menu of tabs), select the new form class from the dropdown list, then click the Create here button.

New Membership Application Form object

In this example, the only fieldswith content are shown below. Since all other attributes areinformation collectors, they can be left blank.

Object fields part 1

Object fields part 2

Once you are done filling in the object's contents, click the Send for publishing button.

The form information that is sent by email is also stored in eZ Publish. It can be accessed in templates using collectedinfo fetch functions (see the technical manual for more information about fetch functions). The main way to view this information is in the Collected information interface under the Setup tab of the Administration Interface.

From there you will see an entry for the Membership Application Form object:

List of collected information objects

posted @ 2010-04-21 10:33  DavidHHuan  阅读(844)  评论(0编辑  收藏  举报