Skip to content
Nicolas Liautaud edited this page Mar 26, 2014 · 6 revisions

The minimum tag create a form using the default fields and target email defined in [settings].

(% contact %)

Parameters may be defined after a colon, separated by commas.

(% contact : parameter %)
(% contact : parameter, parameter, ... %)

You can thus add form recipients by indicating email addresses.

(% contact : [email protected] %)
(% contact : [email protected], [email protected], ... %)

Construct a custom form by adding parameters specifying field types.

(% contact : field, field, field, ... %)

By replacing ''field'' by valid fields types and/or fields options.

There is two sorts of fields types : the specials and the generals.

Fields types

Specials types, doing specific actions :

  • name : a text field used as source name in email. Default : Anonymous.
  • email : a text field with email format verification, used as source address in email. Default : anonymous.
  • subject : a text field used as subject in email. Default : (No subject).
  • phone : a text field with phone number format verification.
  • website : a text field with web address format verification.
  • message : a text area with minimum text length verification.
  • captcha : a capcha image with text field entry verification.
  • fieldcaptcha : a simple capcha system. Add a field with the mention do not fill this field. If the field is filled, it's a robot. :p
  • password : a text field with input value verification.
  • askcopy : a checkbox allowing the user to receive a copy of the email.

General fields types to gather various information indicated in the received mail.

  • text : a text field, for short information (one line).
  • textarea : a textarea field, for longer information (multi-line).
  • checkbox : one or more check boxes and labels. Several may be checked.
  • radio : one or more radio buttons and labels. Only one may be checked.
  • select : a drop down list with defined values.

Unknown/other fields types will be displayed as a solitary label that may be used to create separation texts or custom titles using CSS.

(% contact : answer "This is an answer", response "This is the response" %)
/* apply to every fields */
.p01-contact .field{margin:5px;}
/* those are known fields */
.p01-contact .text{margin:5px;}
.p01-contact .captcha{margin:10px;}
/* those are user-defined fields (labels only) */
.p01-contact .answer{color:red;}
.p01-contact .response{color:blue;}

Fields options

The field options are defined after the field type, to customize it.

  • ! : an exclamation mark define the field as required. A required field left empty will display a "This field is required" error.
  • " : some text between quotes define a custom field label.
  • = : some text after an equality symbol add a pre-filled value. For password field it define the required value.
  • => : some text after an arrow symbol define a locked value.

Examples

fieldtype!             required
fieldtype "text"       custom label
fieldtype = value      pre-filled value / password required value
fieldtype => value     locked value

The multiple values or locked values of checkbox, radio or select fields are separated by vertical bars. The keyword selected define the one(s) selected by default.

checkbox = "value1" selected | "value2" selected
select => "value1" | "value2" selected | "value3"

Multiple options have to be used in the following order :

fieldType! "text" => value | value

Examples

Default :

(% contact %)

Default with two custom recipients :

(% contact : [email protected], [email protected] %)

A custom minimal one :

(% contact : email!, message! %)

A custom big one :

(% contact : [email protected], [email protected],
         subject => About this script,
         email!,
         textarea "How old is born Napoléon?",
         phone,
         radio "Do you like this script?" = "Yes" selected | "No", 
         website,
         select = "One" selected | "Two" | "Three" | "Four" | "Five" ,
         message = Say something!,
         password = tomato,  
         captcha, 
         askcopy %)
Clone this wiki locally