Form templates

Location and naming

The templates that are used in the miniform module are located in the directory {website_root}/modules/minifrorm/templates/ and are named like form_some_name_for_your_form.htt. The name needs to begin with "form_" to be seen as minform form.

 

Styles

The standard templates are all built with styling through the module frontend.css. The styles used are fully responsive and are tested to work with standard frameworks like Bootstrap, Foundation and Skeleton, but you are free to build your forms around your own template styling.

 

File structure

The templates are standard HTML blocks that will be inserted in your webpage.
The default templates use a container <div> with the class named "miniform". All form related styling is done with this class as leading selector.

A message div is used to output messages like "Please fill all required fields" and the message after a form is successfully submitted.
The div is hidden by css if there is nothing to tell by using a class that will set display:none;

 

Outputfields in templates

A template uses fields that will be used by the module. A field is seen as field when it is enclosed between { and } and in uppercase characters.

The standard fields you can use are WebsiteBaker related fields {WEBSITE_TITLE}, {WB_URL}, {URL}, {MEDIA_DIRECTORY} and {SERVER_EMAIL}.
Note: Since the values of form-fields use the same format you should not use these names as fieldnames.

Other template fields that are used are:

{MESSAGE_CLASS} = set to "hidden" if there is no message to show
{STATUSMESSAGE} = the errormessage if not all required fields are filled, or successmessage.
{FORM_CLASS} = set to hidden after a form is successfully sent.
{ASPFIELDS} = Will include a few fake invisible fields into the form as honeypot for spammers.
{CAPTCHA_CLASS} = To be used in a class="". Will be set to hidden if no captcha is used.
{CAPTCHA_ERROR} = To be used in a class="". Will be set to missing if the captcha is wrong.
{CAPTCHA} = The captcha line generated by WB. The style is set in the CAPTCHA admintool.
 

Form fields

All form field names for the miniform module are prefixed with the characters mf_. If you need an input field for "Company" the nameof the field should be mf_company.
For a required field the prefix needs to be mf_r_. So if the "Company" field is a required field you should name it mf_r_company.

More information about this in the next pages.

 

Multiple Forms per page (since v0.5)

If you need multiple forms on a single page, you will need to tell the miniform engine what form shuld be processed.
To do that you simply include a hidden inputfield with the name "miniform" and as value {SECTION_ID}.

<input name="miniform" type="hidden" value="{SECTION_ID}"/>

Note that the Captcha's in WebsiteBaker (2.8.3 and older) will have problems with multiple captcha's on a single page.
The only working captcha to use is the "Calculate text only",

When using just one form all captcha styles should work.

 

Spam protection

For spam protection the miniform module uses the same methods as other WebsiteBaker form modules.

ASP

This feature adds a few hidden fields in your form that should not be filled.
If a spam robot fills the form it will be likely that these forms are filled too.
If so, the form is "accepted" but not sent.

To use the feature just add {ASPFIELDS} somewhere in your form.

Note: Modern browsers (like Chrome) can use an autofill functionality for forms. This will fill the hidden fields as well. Using this feature is not really advised anymore.

CAPTCHA

The captcha functionality built in WebsiteBaker can be used by adding {CAPTCHA} in your template.
The method used is whatever you have configured in the admintools pages as your preferred Captcha method.

To show an error for a missing or wrong captcha you can user {CAPTCHA_ERROR} in your template.
Look at the contactform templates for a complete configuration.