Form Builder

Create or edit forms and manage submitted entries.

The $forms API variable is present if the commercial module FormBuilder is installed. Below are examples of embed method B and C. There are also embed methods A and D and instructions for those can be found on the "Embed" tab when editing a form.

// Embed method B (in iframe)
echo $forms->embed('form-name');

// Embed method C (preferred method)
$form = $forms->render('form-name');
echo $form->styles; // preferably in <head>
echo $form->scripts; // preferably in <head> or before </body>
echo $form; // wherever form should output

Please see FormBuilderProcessor for most of the hookable methods in FormBuilder, this is where most API usage and customization occurs. FormBuilderProcessorAction modules can also be used to affect any part of a form’s life cycle.

More FormBuilder class reference pages

ClassDescription
FormBuilderProcessorHandles most parts of a form’s life cycle (rendering, processing).
FormBuilderEntriesManages the data submitted to a form, which we refer to as an entry.
FormBuilderEmailHandles the setup and distribution of administrator and auto-responder emails.
FormBuilderFormThis class represents a form and maintains its configuration data and fields.
FormBuilderProcessorActionThe full documented interface for FormBuilder plugin-in modules.

Click any linked item for full usage details and examples. Hookable methods are indicated with the icon. In addition to those shown below, the FormBuilder class also inherits all the methods and properties of: WireData and Wire.

Show $var?     Show args?       Only hookable?    

Tools

NameReturnSummary 
$forms->entryToForm($entry)
bool FormBuilderFormGiven an entry array or ID return the FormBuilderForm object that it belongs to 
$forms->form($form)
FormBuilderFormConvert given value to FormBuilderForm if it isn’t already 
$forms->formID($value)
intConvert given value to form ID if is isn’t already 
$forms->formName($value)
stringConvert given value to form name if is isn’t already 
$forms->getFramework(FormBuilderForm $form)
FormBuilderFramework nullGet the framework used by the given $form 
$forms->isForm($id)
boolGiven a form ID or name, returns true if is used by a form, false if not 
$forms->isReservedName(string $name)
boolIs the given name reserved? If true, it should not be used for form or field name 

Access

NameReturnSummary 
$forms->hasPermission(string $name, $form)
boolCheck if the current user has the permission name for the given $form 

Export import

NameReturnSummary 
$forms->exportJSON($form)
stringReturn the JSON schema for the given form (name, ID or object) 
$forms->importJSON($form, string $json)
boolImport to form (name, ID or object) the given JSON schema 

For hooks

These methods are only useful for hooking and should not be called directly.

Additional methods and properties

In addition to the methods and properties above, FormBuilder also inherits the methods and properties of these classes:

API reference based on ProcessWire core version 3.0.251