The [Fields] section of the settings file determines what fields you want on the contact form, and in what order they appear. It also specifies the type of each field, whether it is required (mandatory), the CSS class to use for styling the field, and whether the field name should be shown as a label on the form.
Each line of the Fields section must be in the form
field_name = type,cssclass,required,showlabel
Where:
For example:
[Fields] your_name = text,widebox,1,1 your_email = email,,1 comments = textarea
These are the recognised field types:
Type | Remark |
---|---|
amount | an HTML text input for numbers only (2 decimal places), which may have minimum and maximum values defined in the field options section. |
check | an HTML checkbox input. The text of the checkbox can be defined in the field options section. |
date |
a group of 3 drop-down lists for day, month and year. The pre-selected date and number of years to be listed can be defined
in the field options section. The months will be in English by default, but you can present your own language by defining an array $AllMonths in your include text before the require_once() statement. For example: <?php $AllMonths = array(1=>'janvier', 2=>'février', 3=>'mars', 4=>'avril', ... ); require_once('twzContact.php'); ?> |
datelist | a single drop-down list of dates. The pre-selected date and actual days to be listed can be defined in the field options section. |
calendar | a popup calendar (relies on Javascript being enabled). When using a calendar, there are additional HTML tags that must be included in your page. Please refer to the sample form.php for further information. A number of calendar settings can be customised in the field options section. |
an HTML text input which will be checked for valid email address | |
file | a file upload control. The file will be uploaded to the directory specified in UploadDir (general options section), and the email sent to you will include a link to the file. |
integer | an HTML text input for whole numbers only, which may have minimum and maximum values defined in the field options section. |
number | an HTML text input for numbers only, which may have minimum and maximum values defined in the field options section. |
phone | an HTML text input, formatted as Australia phone/fax number if possible |
radio | a radio button (showing options one per line). The options must be defined in the field options section. |
radio1 | a radio button (showing options all on one line). The options must be defined in the field options section. |
select | an HTML select (drop-down) list. The list options must be defined in the field options section. For a drop-down list of dates, you could use the 'datelist' field type as an alternative. |
text | an HTML text input box |
textarea | an HTML textarea, for entering multiple lines of text |
captcha | a security feature which asks the user to type characters presented in an image. Optionally, you can change the image properties in the field options section. |
SPECIAL FIELD TYPES The following field types are not true fields, but are used for information and layout purposes |
|
line | a horizontal rule (HTML <hr /> tag). Like other fields this can be given a classname, and styled to look how you want it. |
space | an empty row |
note | free text, limited to the right column (compare string). The actual text string must be defined in the field options section. |
string | free text, spanning the full width of the form (compare note). The actual text string must be defined in the field options section. |
hidden | a hidden field, whose value can come from a custom PHP function. See the field options section. |
fieldset | marks the beginning of a fieldset which allows you to group fields into sections, with a border around them. The fieldset legend is defined in the field options section. |
endset | marks the end of a fieldset |
For an idea of how each field type appears on the form, see Field types.
The field_name for special types (line, space, etc) is never shown, but each one still needs to be unique. If you need several horizontal lines in your form, you could name them line1, line2, etc or perhaps ___1, ___2, etc.
[Fields] name = text,wide,1 comments = textarea,widearea,1 email = text,wide,1 divider1 = line send_brochure = check,,0,0 month = select year = select