Overview

Packages

  • akismet
  • None
  • PHP
  • Smarty
    • Cacher
    • Compiler
    • Config
    • Debug
    • plugins
    • PluginsBlock
    • PluginsFilter
    • PluginsFunction
    • PluginsInternal
    • PluginsModifier
    • PluginsModifierCompiler
    • PluginsShared
    • Security
    • Template
    • TemplateResources
  • Swift
    • ByteStream
    • CharacterStream
    • Encoder
    • Events
    • KeyCache
    • Mailer
    • Mime
    • Plugins
    • Signatures
    • Signed
    • Transport
  • wa-apps
    • blog
      • actions
        • backend
        • blog
        • comment
        • cron
        • design
        • frontend
        • page
        • plugin
        • post
      • api
        • v1
      • cli
      • layout
      • model
      • plugin
        • aksimet
        • category
        • emailsubscription
        • favorite
        • gravatar
        • import
        • markdown
        • myposts
        • tag
        • troll
      • settings
    • checklists
      • backend
      • json
    • contacts
      • backend
    • developer
    • dummy
    • guestbook
    • guestbook2
    • photos
      • album
      • api
        • v1
      • backend
      • design
      • dialog
      • frontend
      • page
      • photo
      • plugin
        • comment
        • imageeffects
        • import
        • publicgallery
        • watermark
      • search
      • settings
      • stack
      • tag
      • upload
    • site
      • backend
      • blocks
      • config
      • design
      • domains
      • files
      • frontend
      • helper
      • layout
      • pages
      • routing
      • setting
    • stickies
      • api
        • v1
      • sheet
      • stiky
  • wa-plugin
    • payment
    • shipping
    • sms
  • wa-plugins
    • shipping
      • usps
  • wa-system
    • API
    • Auth
      • Adapters
    • Autoload
    • Cache
      • Adapter
    • Captcha
    • Config
    • Contact
    • controller
    • currency
    • database
    • datetime
    • design
    • event
    • exception
    • files
    • image
    • layout
    • locale
    • log
    • mail
    • page
      • action
      • model
    • payment
    • plugin
    • request
    • response
    • routing
    • shipping
    • sms
    • storage
    • user
    • util
    • validator
    • view
    • webasyst
      • api
      • backend
      • cli
      • config
      • layout
      • login
      • model
      • password
      • payment
      • profile
      • settings
      • shipment
    • widget
    • workflow
  • waPlugins
    • Payment
  • webasyst
    • wa-system
      • helper

Classes

  • waContact
  • waContactAddressField
  • waContactAddressForMapFormatter
  • waContactAddressOneLineFormatter
  • waContactAddressSeveralLinesFormatter
  • waContactBirthdayField
  • waContactBirthdayJSFormatter
  • waContactBirthdayLocalFormatter
  • waContactBranchField
  • waContactCategoriesField
  • waContactCategoryStorage
  • waContactCheckboxField
  • waContactChecklistField
  • waContactCompositeField
  • waContactConditionalField
  • waContactCountryField
  • waContactCountryFormatter
  • waContactDataStorage
  • waContactDataTextStorage
  • waContactDateField
  • waContactDateLocalFormatter
  • waContactEmailField
  • waContactEmailListFormatter
  • waContactEmailStorage
  • waContactEmailTopFormatter
  • waContactField
  • waContactFieldFormatter
  • waContactFields
  • waContactForm
  • waContactHiddenField
  • waContactIMJSFormatter
  • waContactIMTopFormatter
  • waContactInfoStorage
  • waContactLocaleField
  • waContactLocaleFormatter
  • waContactNameField
  • waContactNumberField
  • waContactPasswordField
  • waContactPhoneField
  • waContactPhoneFormatter
  • waContactPhoneJsFormatter
  • waContactPhoneTopFormatter
  • waContactRadioSelectField
  • waContactRegionField
  • waContactsCollection
  • waContactSelectField
  • waContactSelectFormatter
  • waContactSocialNetworkJSFormatter
  • waContactSocialNetworkTopFormatter
  • waContactStorage
  • waContactStringField
  • waContactTextField
  • waContactTimezoneField
  • waContactUrlField
  • waContactUrlHtmlFormatter
  • waContactUrlJsFormatter
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo

Class waContactForm

Builder of forms containing contact fields.

Package: wa-system\Contact
Located at wa-system/contact/waContactForm.class.php
Methods summary
public static
# loadConfig( string|array $file, array $options = array() )

Factory method to load form fields from config.

Factory method to load form fields from config.

Config must return an array: field_id => waContactField OR array of options to specify on existing field with given field_id.

Parameters

$file
string|array
$file path to config file, or array of config options.
$options
array
$options
protected static
# getClone( mixed $f, mixed $opts )
public
# __construct( array $fields = array(), array $options = array() )

Options:

  • namespace
    • Prefix for all fields of this form.
    • Defaults to 'data'.

Options:

  • namespace - Prefix for all fields of this form. - Defaults to 'data'.

Parameters

$fields
array
$fields list of waContactField
$options
array
$options
public
# setValue( mixed $field_id, mixed $value = null )

Set form value. Note that when POST exists, data from POST overwrite setValue(). Accepts 1 or 2 parameters.

  • 1 parameter: array field_id => value. Set several values.
  • 1 parameter: waContact. Fetch data via waContact->load()
  • 2 parameters: field_id, value. Set value for single field.

Set form value. Note that when POST exists, data from POST overwrite setValue(). Accepts 1 or 2 parameters.

  • 1 parameter: array field_id => value. Set several values.
  • 1 parameter: waContact. Fetch data via waContact->load()
  • 2 parameters: field_id, value. Set value for single field.
public mixed
# post( string $field_id = null )

Parameters

$field_id
string
$field_id

Returns

mixed
POST data for entire form or single form field; null when no POST submitted.
public
# errors( string $field_id = '', string $error_text = null )

Get list of errors for specified field, or append an error to the list.

Get list of errors for specified field, or append an error to the list.

With no parameters returns an array of all errors: field_id => list of strings.

With one parameter returns a list of errors for one field.

With two parameters appends an error to the list of errors for specified field. This sets internal state so that form HTML will contain given error message next to the field. Forces isValid() to return false.

Parameters

$field_id
string
$field_id field_id or null to set message for entire form, not attached to any field.
$error_text
string
$error_text
public boolean
# isValid( mixed $contact = null )

Validate this form and set internal state so that form HTML will contain error messages.

Validate this form and set internal state so that form HTML will contain error messages.

Returns

boolean
true when no errors encountered; otherwise false.
public waContactField|waContactField[]
# fields( string $field_id = null )

Get specified form field or all of them.

Get specified form field or all of them.

Parameters

$field_id
string
$field_id

Returns

waContactField|waContactField[]
public
# html( string $field_id = null, boolean $with_errors = true )

HTML for the whole form or single form field.

HTML for the whole form or single form field.

Parameters

$field_id
string
$field_id
$with_errors
boolean
$with_errors whether to add class="error" and error text next to form fields
public mixed
# opt( string $name = null, mixed $default = null )

Value of a single option, or the whole options array.

Value of a single option, or the whole options array.

Parameters

$name
string
$name
$default
mixed
$default value to return when no option with this $name specified

Returns

mixed
protected
# validateFields( mixed $contact = null )

Make sure POST data is properly validated using waFontactField instances in $this->fields.

Make sure POST data is properly validated using waFontactField instances in $this->fields.

Properties summary
public waContactField[] $fields
#

field_id => waContactField

field_id => waContactField

public array $options
#
public array $errors array()
#

field_id => list of error message strings

field_id => list of error message strings

public array $values array()
#

field_id => value to show in field, as accepted by waContactField->getHTML(). Existing POST data overwrite this.

field_id => value to show in field, as accepted by waContactField->getHTML(). Existing POST data overwrite this.

protected boolean $fields_validated false
#

Used by validateFields() to validate at most once.

Used by validateFields() to validate at most once.

public mixed $contact null
#

Contact to validate this form against.

Contact to validate this form against.

public mixed $post null
#

Can be used to feed faked POST data into this form.

Can be used to feed faked POST data into this form.

My fork of Webasyst Framework API documentation generated by ApiGen 2.8.0