Overview

Classes

  • Quform
  • Quform_Admin_InsertForm
  • Quform_Admin_Page
  • Quform_Admin_Page_Controller
  • Quform_Admin_Page_Dashboard
  • Quform_Admin_Page_Entries
  • Quform_Admin_Page_Entries_Edit
  • Quform_Admin_Page_Entries_List
  • Quform_Admin_Page_Entries_View
  • Quform_Admin_Page_Factory
  • Quform_Admin_Page_Forms_Add
  • Quform_Admin_Page_Forms_Edit
  • Quform_Admin_Page_Forms_List
  • Quform_Admin_Page_Help
  • Quform_Admin_Page_Preview
  • Quform_Admin_Page_Settings
  • Quform_Admin_Page_Tools
  • Quform_Admin_Page_Tools_ExportEntries
  • Quform_Admin_Page_Tools_ExportForm
  • Quform_Admin_Page_Tools_Home
  • Quform_Admin_Page_Tools_ImportForm
  • Quform_Admin_Page_Tools_Migrate
  • Quform_Admin_Page_Tools_Uninstall
  • Quform_Api
  • Quform_Block
  • Quform_Builder
  • Quform_Captcha
  • Quform_ClassLoader
  • Quform_Confirmation
  • Quform_Container
  • Quform_Dashboard_Widget
  • Quform_Dispatcher
  • Quform_Element
  • Quform_Element_Captcha
  • Quform_Element_Checkbox
  • Quform_Element_Column
  • Quform_Element_Container
  • Quform_Element_Container_Iterator
  • Quform_Element_Date
  • Quform_Element_Email
  • Quform_Element_Factory
  • Quform_Element_Field
  • Quform_Element_File
  • Quform_Element_Group
  • Quform_Element_Hidden
  • Quform_Element_Honeypot
  • Quform_Element_Html
  • Quform_Element_Multi
  • Quform_Element_Multiselect
  • Quform_Element_Name
  • Quform_Element_Page
  • Quform_Element_Password
  • Quform_Element_Radio
  • Quform_Element_Recaptcha
  • Quform_Element_Row
  • Quform_Element_Select
  • Quform_Element_Submit
  • Quform_Element_Text
  • Quform_Element_Textarea
  • Quform_Element_Time
  • Quform_Entry_Controller
  • Quform_Entry_Exporter
  • Quform_Entry_List_Settings
  • Quform_Entry_List_Table
  • Quform_Entry_Processor
  • Quform_Entry_UserSearcher
  • Quform_Filter_Abstract
  • Quform_Filter_Alpha
  • Quform_Filter_AlphaNumeric
  • Quform_Filter_Digits
  • Quform_Filter_Regex
  • Quform_Filter_Static
  • Quform_Filter_StripTags
  • Quform_Filter_Trim
  • Quform_Form
  • Quform_Form_Controller
  • Quform_Form_Exporter
  • Quform_Form_Factory
  • Quform_Form_Importer
  • Quform_Form_Iterator
  • Quform_Form_List_Settings
  • Quform_Form_List_Table
  • Quform_Form_Processor
  • Quform_License
  • Quform_Migrator
  • Quform_NonceRefresher
  • Quform_Notification
  • Quform_Notification_Resender
  • Quform_Options
  • Quform_Permissions
  • Quform_Repository
  • Quform_ScriptLoader
  • Quform_Session
  • Quform_Settings
  • Quform_Shortcode
  • Quform_Themes
  • Quform_TokenReplacer
  • Quform_Toolbar
  • Quform_Translations
  • Quform_Updater
  • Quform_Upgrader
  • Quform_Uploader
  • Quform_Validator_Abstract
  • Quform_Validator_Alpha
  • Quform_Validator_AlphaNumeric
  • Quform_Validator_Array
  • Quform_Validator_Captcha
  • Quform_Validator_Date
  • Quform_Validator_Digits
  • Quform_Validator_Duplicate
  • Quform_Validator_Email
  • Quform_Validator_FileUpload
  • Quform_Validator_GreaterThan
  • Quform_Validator_Honeypot
  • Quform_Validator_Identical
  • Quform_Validator_InArray
  • Quform_Validator_Length
  • Quform_Validator_LessThan
  • Quform_Validator_Recaptcha
  • Quform_Validator_Regex
  • Quform_Validator_Required
  • Quform_Validator_Static
  • Quform_Validator_Time
  • Quform_View
  • Quform_ViewFactory
  • Quform_Widget_Form
  • Quform_Widget_Popup

Interfaces

  • Quform_Attachable
  • Quform_Element_Editable
  • Quform_Filter_Interface
  • Quform_Validator_Interface
  • Overview
  • Class

Class Quform_Form

Copyright: Copyright (c) 2009-2022 ThemeCatcher (https://www.themecatcher.net)
Located at Quform/Form.php
Methods summary
public
# __construct( integer $id, string $uniqueId, Quform_Session $session, Quform_TokenReplacer $tokenReplacer, Quform_Options $options )

Parameters

$id
$uniqueId
$session
$tokenReplacer
$options
public
# setId( integer $id )

Set the ID of the form

Set the ID of the form

Parameters

$id
public integer
# getId( )

Get the ID of the form

Get the ID of the form

Returns

integer
public mixed
# config( string|null $key = null, null|mixed $default = null )

Returns the config value for the given $key

Returns the config value for the given $key

If the value is null, the default will be returned

Parameters

$key
The config key
$default
The default value to return if the value key not exist

Returns

mixed
The config value or $default if not set
public
# setConfig( string|array $key, mixed $value = null )

Set the config value for the given $key or multiple values using an array

Set the config value for the given $key or multiple values using an array

Parameters

$key
Key or array of key/values
$value
Value or null if $key is array

Returns


$this
public string
# render( array $options = array(), string $outputOverride = '' )

Render the form and return the HTML

Render the form and return the HTML

Parameters

$options
The options array
$outputOverride
Display this HTML instead of rendering the form

Returns

string
public string
# renderPopup( array $options = array(), string $outputOverride = '' )

Render a popup form

Render a popup form

Parameters

$options
The options array
$outputOverride
Display this HTML instead of rendering the form

Returns

string
protected string
# getTitleDescriptionHtml( boolean $showTitle = true, boolean $showDescription = true )

Get the HTML for the title and description

Get the HTML for the title and description

Parameters

$showTitle
$showDescription

Returns

string
protected array
# getContainerClasses( )

Get the classes for the outermost wrapper

Get the classes for the outermost wrapper

Returns

array
public boolean
# isRtl( )

Is the form RTL?

Is the form RTL?

Returns

boolean
public string
# getLocale( )

Get the locale for this form

Get the locale for this form

Returns

string
public string
# getDateFormat( )

Get the date format for PHP

Get the date format for PHP

Returns

string
public string
# getDateFormatJs( )

Get the date format for JavaScript

Get the date format for JavaScript

Returns

string
public string
# getTimeFormat( )

Get the time format for PHP

Get the time format for PHP

Returns

string
public string
# getTimeFormatJs( )

Get the time format for JavaScript

Get the time format for JavaScript

Returns

string
public string
# getDateTimeFormat( )

Get the datetime format for PHP

Get the datetime format for PHP

Returns

string
public string
# getDateTimeFormatJs( )

Get the datetime format for JavaScript

Get the datetime format for JavaScript

Returns

string
protected array
# getElementsClasses( )

Get the classes for the elements wrapper div

Get the classes for the elements wrapper div

Returns

array
protected string
# getAction( )

Get the action attribute for the <form>

Get the action attribute for the <form>

Returns

string
protected string
# getHiddenInputHtml( )

Get the HTML for the hidden inputs

Get the HTML for the hidden inputs

Returns

string
public array
# getContext( )

Get the context (inheritable settings) for passing to child elements when rendering the form and generating CSS

Get the context (inheritable settings) for passing to child elements when rendering the form and generating CSS

Returns

array
protected string
# getReferralLinkHtml( )

Get the HTML for the Quform referral link

Get the HTML for the Quform referral link

Returns

string
protected string
# getUploadProgressHtml( )

Get the HTML for the file upload progress bar

Get the HTML for the file upload progress bar

Returns

string
protected string
# getEditFormLinkHtml( )

Get the HTML for the edit form link

Get the HTML for the edit form link

Returns

string
public Quform_Form
# addNotification( Quform_Notification $notification )

Add a form notification

Add a form notification

Parameters

$notification

Returns

Quform_Form
public Quform_Notification[]
# getNotifications( )

Get the form notifications

Get the form notifications

Returns

Quform_Notification[]
public Quform_Notification|null
# getNotification( string $identifier )

Get a notification by identifier

Get a notification by identifier

Parameters

$identifier
The notification identifier (aka unique ID)

Returns

Quform_Notification|null
public string
# replaceVariables( string $text, string $format = 'text' )

Replace the variables in the given string

Replace the variables in the given string

Parameters

$text
$format

Returns

string
public string
# replaceVariablesPreProcess( string $text, string $format = 'text' )

Replace the variables in the given text before the form is processed

Replace the variables in the given text before the form is processed

Parameters

$text
$format

Returns

string
public boolean
# isActive( )

Returns

boolean
public Quform_Form
# setIsActive( boolean $flag )

Set whether the form is active

Set whether the form is active

Parameters

$flag

Returns

Quform_Form
public
# addConfirmation( Quform_Confirmation $confirmation )

Add a confirmation

Add a confirmation

Parameters

$confirmation
public
# setConfirmation( )

Set the confirmation to use for this submission

Set the confirmation to use for this submission

If there is only one confirmation, it will be used, otherwise the first matching conditional logic

public Quform_Confirmation
# getConfirmation( )

Get the confirmation to use for this submission

Get the confirmation to use for this submission

Returns

Quform_Confirmation
public string
# getSuccessMessageHtml( string $position = 'above' )

Get the HTML for the success message

Get the HTML for the success message

Parameters

$position

Returns

string
public string
# getPageProgressHtml( )

Get the HTML for the page progress

Get the HTML for the page progress

Returns

string
protected string
# getLoadingHtml( )

Get the HTML for the loading indicator

Get the HTML for the loading indicator

Returns

string
public
# setUniqueId( string $uniqueId )

Set the unique form ID

Set the unique form ID

The unique ID is unique to each form instance, even the same form on the same page

Parameters

$uniqueId
public
# getUniqueId( )

Get the unique form ID

Get the unique form ID

public string
# getJsConfig( )

Get the JavaScript configuration for the frontend

Get the JavaScript configuration for the frontend

Returns

string
public string
# getCharset( )

Get the character encoding

Get the character encoding

Returns

string
public
# setCharset( string $charset )

Set the character encoding

Set the character encoding

Parameters

$charset
public array
# getPages( )

Returns

array
public
# addPage( Quform_Element_Page $page )

Add a page to the form

Add a page to the form

Parameters

$page
The page to add
public
# setValues( array $values, boolean $setOthersEmpty = false )

Set the values for all form elements

Set the values for all form elements

Parameters

$values
The values to set
$setOthersEmpty
Set the value of elements that are not in $values to empty
public array
# isValid( )

Is the form valid?

Is the form valid?

Returns

array
The first value is valid boolean, second is the first page instance that has an error
public array
# getErrors( )

Get the validation errors

Get the validation errors

Returns

array
public
# setShowGlobalError( boolean $flag )

Set the flag to show the global form error message

Set the flag to show the global form error message

Parameters

$flag
public boolean
# getShowGlobalError( )

Get the flag to show the global form error message

Get the flag to show the global form error message

Returns

boolean
public array
# getGlobalError( )

Get the global error message data

Get the global error message data

Returns

array
protected string
# getGlobalErrorHtml( )

Get the HTML for the global form error message if enabled

Get the HTML for the global form error message if enabled

Returns

string
public Quform_Element|null
# getElement( string $nameOrId )

Get the element with the given name

Get the element with the given name

Returns the element or null if it does not exist

Parameters

$nameOrId

Returns

Quform_Element|null
public Quform_Form
# setValue( string|integer $nameOrId, mixed $value )

Set the value of the element with the given name

Set the value of the element with the given name

Parameters

$nameOrId
$value

Returns

Quform_Form
public
# setValueFromStorage( string|integer $nameOrId, mixed $value )

Set the value of the element with the given name

Set the value of the element with the given name

Parameters

$nameOrId
$value

Returns


$this
public array
# getValues( )

Get the values of all fields

Get the values of all fields

Returns

array
The values of all fields
public mixed
# getValue( string|integer $nameOrId )

Get the values of a single field

Get the values of a single field

Parameters

$nameOrId

Returns

mixed
The value of the given field or null
public string
# getValueHtml( string $nameOrId )

Get the value of the element with the given name, formatted in HTML

Get the value of the element with the given name, formatted in HTML

Parameters

$nameOrId
The unique element name

Returns

string
The formatted HTML
public string
# getValueText( string $nameOrId, string $separator = ', ' )

Get the value of the element with the given name, formatted in plain text

Get the value of the element with the given name, formatted in plain text

Parameters

$nameOrId
The unique element name
$separator
The separator for array types

Returns

string
The formatted plain text
public Quform_Element|null
# getElementById( integer $id )

Get the element with the given ID.

Get the element with the given ID.

Returns the element or null if no element was found.

Parameters

$id

Returns

Quform_Element|null
public Quform_Element|null
# getElementByName( string $name )

Get the element with the given name.

Get the element with the given name.

Returns the element or null if no element was found.

Parameters

$name

Returns

Quform_Element|null
public array
# getLogicConfig( )

Get the conditional logic configuration array

Get the conditional logic configuration array

Returns

array
public string
# getCss( )

Get the CSS for this form

Get the CSS for this form

Returns

string
protected array
# getCssSelectors( )

Get the list of CSS selectors

Get the list of CSS selectors

Returns

array
protected string
# getCssSelector( string $type )

Get the CSS selector for the given style type

Get the CSS selector for the given style type

Parameters

$type

Returns

string
public boolean
# hasEnhancedFileUploadElement( )

Does the form have at least one File Upload element with enhanced upload enabled?

Does the form have at least one File Upload element with enhanced upload enabled?

Returns

boolean
public
# setSubmitted( boolean $flag )

Sets whether the form been successfully submitted

Sets whether the form been successfully submitted

Parameters

$flag
public boolean
# isSubmitted( )

Has the form been successfully submitted?

Has the form been successfully submitted?

Returns

boolean
public
# reset( )

Reset all form values to their default

Reset all form values to their default

public
# setDynamicValues( string|array $dynamicValues )

Sets the dynamic values

Sets the dynamic values

Parameters

$dynamicValues
public array
# getDynamicValues( )

Get the dynamic values

Get the dynamic values

Returns

array
public
# calculateElementVisibility( )

Server-side conditional logic processing, determines which form elements are hidden by conditional logic

Server-side conditional logic processing, determines which form elements are hidden by conditional logic

protected
# calculateElementVisibilityHelper( array $elements, array & $ancestors, Quform_Element_Page|null & $currentPage )

Recursive helper function for calculateElementVisibility

Recursive helper function for calculateElementVisibility

Parameters

$elements
$ancestors
$currentPage
public
# setCurrentPageById( integer $pageId )

Set the current page to the one with the given ID

Set the current page to the one with the given ID

Parameters

$pageId
public Quform_Element_Page
# getCurrentPage( )

Get the current page being viewed/processed

Get the current page being viewed/processed

If no page is found it's set to the first page

Returns

Quform_Element_Page
public integer|null
# getNextPageId( boolean $reverse = false )

Get the ID of the next page that isn't conditionally hidden

Get the ID of the next page that isn't conditionally hidden

Parameters

$reverse
If true it will search in reverse and get the previous page

Returns

integer|null
The ID of the next page or null if none found
public integer
# getPageCount( )

Get the total number of pages

Get the total number of pages

Returns

integer
public boolean
# hasPages( )

Does the form have more than one page?

Does the form have more than one page?

Returns

boolean
protected array
# getPageIds( )

Get the array of page IDs

Get the array of page IDs

Send to the JavaScript to determine progress percentage

Returns

array
public Quform_Form
# setEntryId( integer|null $entryId )

Set the current submitted entry ID

Set the current submitted entry ID

Parameters

$entryId

Returns

Quform_Form
public integer|null
# getEntryId( )

Get the current submitted entry ID

Get the current submitted entry ID

Returns

integer|null
public boolean
# checkLogicAction( string $action, string $match, array $rules )

Check the given logic data against the form data and return the action

Check the given logic data against the form data and return the action

Parameters

$action
$match
$rules

Returns

boolean
protected boolean
# isLogicRuleMatch( array $rule )

Does the given logic rule pass with the current form data?

Does the given logic rule pass with the current form data?

Parameters

$rule

Returns

boolean
public Quform_Element_Page|null
# getFirstPage( )

Get the first page of the form

Get the first page of the form

Returns

Quform_Element_Page|null
public Quform_Element_Page|null
# getLastPage( )

Get the last page of the form

Get the last page of the form

Returns

Quform_Element_Page|null
public string
# getSessionKey( )

Get the session storage key for this form

Get the session storage key for this form

Returns

string
public string
# getCsrfToken( )

Get the CSRF protection token

Get the CSRF protection token

Returns

string
public RecursiveIteratorIterator
# getRecursiveIterator( integer $mode = RecursiveIteratorIterator::LEAVES_ONLY )

Get the recursive iterator to iterate over the form elements

Get the recursive iterator to iterate over the form elements

Modes: RecursiveIteratorIterator::LEAVES_ONLY RecursiveIteratorIterator::SELF_FIRST RecursiveIteratorIterator::CHILD_FIRST RecursiveIteratorIterator::CATCH_GET_CHILD

Parameters

$mode

Returns

RecursiveIteratorIterator
public static boolean
# isValidUniqueId( string $id )

Is the given unique ID valid?

Is the given unique ID valid?

Parameters

$id

Returns

boolean
public static string
# generateUniqueId( )

Generate a unique ID (6 digit hex)

Generate a unique ID (6 digit hex)

Returns

string
public string
# getTranslation( string $key, string $default = '' )

Parameters

$key
$default

Returns

string
public static array
# getDefaultConfig( string|null $key = null )

Get the default form configuration

Get the default form configuration

Parameters

$key
Get the config by key, if omitted the full config is returned

Returns

array
Properties summary
protected integer $id
#
protected string $uniqueId

The unique ID is unique to each form instance, even the same form on the same page

The unique ID is unique to each form instance, even the same form on the same page

#
protected Quform_Element_Page[] $pages
# array()
protected array $config
# array()
protected Quform_Notification[] $notifications

Notifications to send

Notifications to send

# array()
protected Quform_Confirmation[] $confirmations

Confirmations

Confirmations

# array()
protected Quform_Confirmation $confirmation

The single confirmation to use for the submission

The single confirmation to use for the submission

#
protected Quform_TokenReplacer $tokenReplacer
#
protected Quform_Options $options
#
protected Quform_Session $session
#
protected boolean $active

Is the form active?

Is the form active?

# true
protected boolean $submitted

Has the form been successfully submitted?

Has the form been successfully submitted?

# false
protected boolean $showGlobalError

The flag for showing the global form error message for non-Ajax forms

The flag for showing the global form error message for non-Ajax forms

# false
protected string $charset

Character encoding to use

Character encoding to use

# 'UTF-8'
protected array $dynamicValues

The dynamic values

The dynamic values

# array()
protected integer|null $entryId

The current submitted entry ID

The current submitted entry ID

#
protected Quform_Element_Page $currentPage

The current page being viewed/processed

The current page being viewed/processed

#
API documentation generated by ApiGen