The main FormItBuilder methods. Most of the program bulk lives within this class and handles a great number of set/get methods and output methods.

package FormItBuilder

 Methods

FormItBuilder

__construct(\modx $modx, string $id) 

The main construction for FormItBuilder. All elements and rules are attached to this object.

Parameters

$modx

\modx

&$modx Reference to the core modX object

$id

string

Id of the form

addElement(FormItBuilder_baseElement $o_formElement)

addElement(FormItBuilder_baseElement $o_formElement) 

Adds a single element object to the main FormItBuilder object.

Parameters

addElements($a_elements)

addElements(array $a_elements) 

Adds multiple element objects to the main FormItBuilder object.

Parameters

$a_elements

array

An array of objects that extend FormItBuilder_baseElement.

addRule(FormRule $formRule)

addRule(FormRule $formRule) 

Adds a single rule to the FormItBuilder object.

Parameters

$formRule

\FormRule

addRules($rules)

addRules(array $rules) 

Adds multiple FormRule objects to the FormItBuilder object.

Parameters

$rules

array

getAutoResponderBCC()

getAutoResponderBCC() : string

Auto Responder - Returns the Auto Responder BCC email address used in the email.

Returns

string

getAutoResponderBCCName()

getAutoResponderBCCName() : string

Auto Responder - Returns the Auto Responder BCC email name used in the email.

Returns

string

getAutoResponderCC()

getAutoResponderCC() : string

Auto Responder - Returns the Auto Responder CC email address used in the email.

Returns

string

getAutoResponderCCName()

getAutoResponderCCName() : string

Auto Responder - Returns the Auto Responder CC email name used in the email.

Returns

string

getAutoResponderEmailContent()

getAutoResponderEmailContent() : string

Auto Responder - Returns the Auto Responder email content.

Returns

string

getAutoResponderFromAddress()

getAutoResponderFromAddress() : string

Auto Responder - Returns the Auto Responder FROM email address used in the email.

Returns

string

getAutoResponderFromName()

getAutoResponderFromName() : string

Auto Responder - Returns the Auto Responder FROM email name used in the email.

Returns

string

getAutoResponderHtml()

getAutoResponderHtml() : boolean

Auto Responder - Returns the Auto Responder HTML setting used in the email.

Returns

boolean

getAutoResponderReplyTo()

getAutoResponderReplyTo() : string

Auto Responder - Returns the Auto Responder REPLY-TO email address used in the email.

Returns

string

getAutoResponderSubject()

getAutoResponderSubject() : string

Auto Responder - Returns the Auto Responder subject used in the email.

Returns

string

getAutoResponderToAddressField()

getAutoResponderToAddressField() : string

Auto Responder - Returns the Auto Responder TO email address FIELD used in the email.

Returns

string

getAutoResponderTpl()

getAutoResponderTpl() : string

Returns the Auto Responder template chunk used.

Returns

string

getCustomValidators()

getCustomValidators() : string

Returns any customValidator settings used by the form. (Used with the FormIT "validate" command to create custom validation. See customValidators in FormIt documentation for more information).

Returns

string

getEmailBCCAddress()

getEmailBCCAddress() : string

Returns the BCC email address used when sending email.

Returns

string

getEmailBCCName()

getEmailBCCName() : string

Returns the BCC email name used when sending email.

Returns

string

getEmailCCAddress()

getEmailCCAddress() : string

Returns the CC email address used when sending email.

Returns

string

getEmailCCName()

getEmailCCName() : string

Returns the CC email name used when sending email.

Returns

string

getEmailFootHtml()

getEmailFootHtml() : string

Returns the footer HTML used in the email.

Returns

string

getEmailFromAddress()

getEmailFromAddress() : string

Returns the FROM email address used when sending email.

Returns

string

getEmailFromName()

getEmailFromName() : string

Returns the FROM email name used when sending email.

Returns

string

getEmailHeadHtml()

getEmailHeadHtml() : string

Returns the header HTML used in the email.

Returns

string

getEmailReplyToAddress()

getEmailReplyToAddress() : string

Returns the REPLY-TO email address used when sending email.

Returns

string

getEmailReplyToName()

getEmailReplyToName() : string

Returns the REPLY-TO email name used when sending email.

Returns

string

getEmailSubject()

getEmailSubject() : string

Returns the email subject used when sending email.

Returns

string

getEmailToAddress()

getEmailToAddress() : string

Returns the TO email address used when sending email.

Returns

string

getEmailToName()

getEmailToName() : string

Returns the TO email name used when sending email.

Returns

string

getEmailTpl()

getEmailTpl() : array

Returns the email template chunks used by the FormIt call. By default this is set to use FormItBuilderEmailTpl which is an installed chunk containing a single placeholder to allow FormItBuilder to dynamically generate and create the chunk content on the fly.

Returns

array

getHooks()

getHooks() : array

Returns the list of hooks that are set in the formIT call. e.g. "spam","email","redirect" etc.

Returns

array

getId()

getId() : string

Returns the form ID.

Returns

string

getJqueryValidation()

getJqueryValidation() : boolean

Returns the forms jQuery validate setting.

Returns

boolean

getMethod()

getMethod() : string

Returns the form method (get, post etc)

Returns

string

getPlaceholderJavascript()

getPlaceholderJavascript() : string

Returns javascript placeholder setting used.

Returns

string

getPostHookName()

getPostHookName() : string

Returns the post hook snippet name (normally set to the same snippet name for the FormItBuilder form)

Returns

string

getRedirectDocument()

getRedirectDocument() : string

Returns the forms redirectDocument setting.

Returns

string

getStore()

getStore() : boolean

Returns the store option used. See the FormIt "store" option.

Returns

boolean

getValidate()

getValidate() : string

Returns the custom validation methods used (doesnt include the validation rules automatically set by rules etc).

Returns

string

output()

output() : string

Output the FormItBuilder source.

Returns

string

outputRaw()

outputRaw() 

FOR DEBUGGING ONLY - Gets the FormItBuilder output source and prints to screen. Following this a hard exit is called. This allows users to see the raw FormIt syntax to ensure the source is written as expected.

postHook() - SOON TO BE MADE PRIVATE - SHOULD CALL processCoreHook METHOD INSTEAD

postHook() : string

Gets the post hook email template chunk string.

Returns

string

postHookRaw()

postHookRaw() 

FOR DEBUGGING ONLY - Gets the post hook string and echos it out followed by a hard exit. This allows users to see the raw FormIt syntax to ensure the source is written as expected.

processCoreHook(&$hook,&$formObj)

processCoreHook(\hook $hook, \FormItBuilder $formObj) : boolean

Other hooks call this method which sets placeholder content for email and autoresponder template chunks.

Parameters

$hook

\hook

Reference to the formIt hook object.

$formObj

\FormItBuilder

Reference to the FormItBuilder form object.

Returns

boolean

processHooks($a_hookCommands)

processHooks(array $a_hookCommands) : boolean

Called from the FormItBuilder_hooks snippet. Not intended to be called publically in any other way. This process should be automatic.

Parameters

$a_hookCommands

array

Returns

boolean

setAutoResponderBCC($value)

setAutoResponderBCC(string $value) 

Auto Responder - Optional. A comma-separated list of emails to send via bcc.

Parameters

$value

string

setAutoResponderBCCName($value)

setAutoResponderBCCName(string $value) 

Auto Responder - Optional. A comma-separated list of names to pair with the fiarBCC values.

Parameters

$value

string

setAutoResponderCC($value)

setAutoResponderCC(string $value) 

Auto Responder - Optional. A comma-separated list of emails to send via cc.

Parameters

$value

string

setAutoResponderCCName($value)

setAutoResponderCCName(string $value) 

Auto Responder - Optional. A comma-separated list of names to pair with the fiarCC values.

Parameters

$value

string

setAutoResponderEmailContent($value)

setAutoResponderEmailContent(string $value) 

Auto Responder - Sets the email content.

Parameters

$value

string

setAutoResponderFromAddress($value)

setAutoResponderFromAddress(string $value) 

Auto Responder - Optional. If set, will specify the From: address for the email. Defaults to the emailsender system setting.

Parameters

$value

string

setAutoResponderFromName($value)

setAutoResponderFromName(string $value) 

Auto Responder - Optional. If set, will specify the From: name for the email.

Parameters

$value

string

setAutoResponderHtml($value)

setAutoResponderHtml(boolean $value) 

Auto Responder - Optional. Whether or not the email should be in HTML-format. Defaults to true.

Parameters

$value

boolean

setAutoResponderReplyTo($value)

setAutoResponderReplyTo(string $value) 

Auto Responder - An email to set as the reply-to.

Parameters

$value

string

setAutoResponderReplyToName($value)

setAutoResponderReplyToName(string $value) 

Auto Responder - Optional. The name for the Reply-To field.

Parameters

$value

string

setAutoResponderSubject($value)

setAutoResponderSubject(string $value) 

Auto Responder - The subject of the email.

Parameters

$value

string

setAutoResponderToAddressField($value)

setAutoResponderToAddressField(string $value) 

Auto Responder - The name of the form field to use as the submitters email. Defaults to "email".

Parameters

$value

string

setAutoResponderTpl($value)

setAutoResponderTpl(string $value) 

Auto Responder - Tpl chunk for auto-response message.

Parameters

$value

string

setCustomValidators($value)

setCustomValidators(string $value) 

Sets the customValidator settings used by the form. (Used with the FormIT "validate" command to create custom validation. See customValidators in FormIt documentation for more information).

Parameters

$value

string

setDatabaseObjectForInsert($s_objName,$a_mapping)

setDatabaseObjectForInsert(object $s_objName, array $a_mapping) 

Sets the database table object to use to automatically insert the form information on a successful submission.

//Demo Table Mapping (Allows auto entry of data into an mysql Table (xPDO object)
$o_form->setDatabaseObjectForInsert('tableClass',array(
array($o_name,'name'),
array($o_address,'address'),
array($o_country,'country'),
));

Parameters

$s_objName

object

The table class name used by the XPDO object.

$a_mapping

array

Should contain an array which maps each form object to a field key within the table.

setEmailBCCAddress($value)

setEmailBCCAddress(string $value) 

Sets the BCC email address used when sending email.

Parameters

$value

string

setEmailBCCName($value)

setEmailBCCName(string $value) 

Sets the BCC email name used when sending email.

Parameters

$value

string

setEmailCCAddress($value)

setEmailCCAddress(string $value) 

Sets the CC email address used when sending email.

Parameters

$value

string

setEmailCCName($value)

setEmailCCName(string $value) 

Sets the FROM email name used when sending email.

Parameters

$value

string

setEmailFootHtml($value)

setEmailFootHtml(string $value) 

Sets the footer HTML used in the email.

Parameters

$value

string

setEmailFromAddress($value)

setEmailFromAddress(string $value) 

Sets the FROM email address used when sending email.

Parameters

$value

string

setEmailFromName($value)

setEmailFromName(string $value) 

Sets the FROM email address used when sending email.

Parameters

$value

string

setEmailHeadHtml($value)

setEmailHeadHtml(string $value) 

Sets the header HTML used in the email.

Parameters

$value

string

setEmailReplyToAddress($value)

setEmailReplyToAddress(string $value) 

Sets the REPLY-TO email address used when sending email.

Parameters

$value

string

setEmailReplyToName($value)

setEmailReplyToName(string $value) 

Sets the REPLY-TO email name used when sending email.

Parameters

$value

string

setEmailSubject($value)

setEmailSubject(string $value) 

Sets the email subject used when sending email.

Parameters

$value

string

setEmailToAddress($value)

setEmailToAddress(string $value) 

Sets the TO email address used when sending email.

Parameters

$value

string

setEmailToName($value)

setEmailToName(string $value) 

Sets the TO email name used when sending email.

Parameters

$value

string

setEmailTpl($value)

setEmailTpl(string $value) 

Sets the email template chunk used by the FormIt call. By default this is set to use FormItBuilderEmailTpl which is an installed chunk containing a single placeholder to allow FormItBuilder to dynamically generate and create the chunk content on the fly.

Parameters

$value

string

setHooks($value)

setHooks(array $value) 

Sets the list of hooks that are set in the formIT call. e.g. "spam","email","redirect" etc.

Parameters

$value

array

Array containing hook strings

setJqueryValidation($value)

setJqueryValidation(boolean $value) 

Sets the forms jQuery validate setting. When set to true extra javascript is output for "jQuery Validate" to use. If jQuery Validate is installed correctly, forms should validate with inline javascript (jQuery) as well as with FormIt validation with PHP.

Parameters

$value

boolean

setMethod($value)

setMethod(string $value) 

Sets the form method (get, post etc)

Parameters

$value

string

setPlaceholderJavascript($value)

setPlaceholderJavascript(string $value) 

Sets a placeholder to use to inject any javascript used to control the form (jQuery Validate etc). By default any javascript required for forms is output inline after the closeure of the form (as you can see when viewing the HTML source). This may not be desirable for some developers as javascript order may be an issue. For simplicity it has been set this way by default for the majority of users that want to get their form up and running with minimal fuss.

To do this add the following code to your form object.

$o_form->setPlaceholderJavascript('FormItBuilder_javascript_myForm');

The string used in this method will be your placeholder name. Simply add the placeholder code to your template like so

[[+FormItBuilder_javascript_myForm]]

Parameters

$value

string

setPostHookName($value)

setPostHookName(string $value) 

Sets the post hook snippet name (normally set to the same snippet name for the FormItBuilder form).

Parameters

$value

string

setRedirectDocument($value)

setRedirectDocument(string $value) 

Sets the forms redirectDocument setting (used if the redirect hook is also set).

Parameters

$value

string

The resource ID of the page to redirect to post success.

setStore($value)

setStore(boolean $value) 

Sets the store option used by FormIt. If true, will store the data in the cache for retrieval using the FormItRetriever snippet.

Parameters

$value

boolean

setValidate($value)

setValidate(string $value) 

Sets the custom validation methods used (doesnt include the validation rules automatically set by rules etc).

Parameters

$value

string