Including a contact for on a page in aPeel is easy. A contact form can be included directly in the page content (editable through the admin) or can be included in a template or layout.
Here is the code for a very simple contact form. All of the pieces will be discussed below.
{% mailer_form %}
{{ errors }}
{% if submitted_ok %}
<h3>The following values were submitted. Thank you!</h3>
{{ submitted_ok }}
{% endif %}
<label>Name : {% form_text name %}</label><br/>
<label>Email : {% form_text email %}</label><br/>
<br/>
<label>
What's on your mind?<br/>
{% form_text_area comments rows:12 cols:88 %}
</label>
<br/>
<input type="submit" name="submit" value="Submit"/>
{% form_required name,email,comments %}
{% form_excludes none %}
{% form_includes name,email,comments %}
{% endmailer_form %}
Syntax
{% mailer_form %} ... {% endmailer_form %}
This tag pair starts and ends your contact form. Everything in between is the contents of your form as well as some special instructions that tell the aPeel servers how to process your form.
Syntax
{{ errors }}
This tag will display any errors that were encountered in processing a submitted form. Usually this will be a notification that some required fields were left blank.
Syntax
{% form_text field_name [initial_value]%}
This tag allows you to add a single line text field to your form. It only adds the text box itself. It's up to you to include a lable and any descriptive text that you need. You should replace field_name with the name of the field. If you want for the field to start out with a value in it you can include that after the field_name, enclosed in single quotes. For example:
{% form_text first_name 'Bob' %}
This will be turned into
Syntax
{% form_select field_name "option1","option2"... %}
This tag allows you to create a select list, or drop down list, in your form. Replace field_name with whatever you want the name of the field to be. Populate the select list with options by including them after the field name. Each option should be enclosed in double quotes and separated by a comma.
{% form_select favorite_color "","Blue","Red",Green" %}
Will produce:
Syntax
{% form_text_area field_name rows:12 cols:88 %}
This tag allows you to add a large text area to your form. As with all other form elements field_name should be replace with the name you want to give the field. The rows and cols options can be customized to allow you to precisely control the size of the text area.
{% form_text_area description rows:4 cols:20 %}
will become: