Class WFForm

Description

A wrapper for HTML Form Elements.

Technical note: Since PHOCOA depends on knowing the button that was used to submit the form to call the correct action method, things can get tricky because browsers will "guess" which button is the default button if a user presses RETURN/ENTER in a single-line field.

Firefox and Safari seem to "guess" somehow which is the default button, even if there is more than one button. I am not sure how they decide which, but they do.

IE on the other hand, does NOT select a default button, yet it still submits the form, WITHOUT ANY SUBMIT INFO. Thus this caused PHOCOA errors since PHOCOA didn't call the expected action. Basically phocoa would have a submitted form, but then no action would be called. This is never supposed to happen, and caused some phocoa modules to have unexpected results.

To fix this, WFForm has a concept of a defaultSubmitID. This is the ID of the button that should be used as the default action. If your form has exactly one submit button, the default button will be automatically selected. Otherwise, you'll need to specify it by configuring a defaultSubmitID for your form. What this means in practice is that if you have a form with 2+ buttons, you really should set a defaultSubmitID to avoid bugs in some browsers.

WFForm features built-in CSRF protection for form submissions, ajax form submissions, and WFAppcelerator service requests.

Located in /framework/widgets/WFForm.php (line 30)

WFObject
   |
   --WFView
      |
      --WFWidget
         |
         --WFForm
Direct descendents
Class Description
WFAutoForm An automatic rendering form subclass of WFForm.
WFPostletUpload A Java upload widget for our framework.
Class Constant Summary
Variable Summary
string $action
boolean $isAjax
string $method
Method Summary
static void calculateCSRFParams ()
static void exposedProperties ()
WFForm __construct ( $id,  $page)
void addChild (WFView $view)
void defaultSubmitID ()
void isAjax ()
void render ([ $blockContent = NULL])
void setAction ( $action)
void setIsAjax ( $b)
void setMethod ( $method)
Variables
string $action (line 44)
  • var: The action attribute of the HTML form. By default, the current URI.
  • access: protected
string $defaultSubmitID (line 53)
  • var: The ID of the "default" button. This is the button that should be used as the action if no button information is submitted.
  • access: protected
boolean $isAjax (line 67)
  • var: Set to true to turn this into an ajax-enabled form.
  • access: protected
string $method (line 49)
array $phocoaFormParameters (line 62)
  • var: An array of form parameters that a phocoa form needs to be correctly processed. Subclasses may need access to these to ensure proper phocoa form compatibility.
  • access: protected

Inherited Variables

Inherited from WFWidget

WFWidget::$bindings
WFWidget::$class
WFWidget::$errors
WFWidget::$formatter
WFWidget::$hasRestoredState
WFWidget::$hidden
WFWidget::$name
WFWidget::$value
WFWidget::$widgetLabel

Inherited from WFView

WFView::$children
WFView::$cssImports
WFView::$enabled
WFView::$id
WFView::$importInHead
WFView::$jsActions
WFView::$jsEvents
WFView::$jsImports
WFView::$page
WFView::$parent
Methods
static method calculateCSRFParams (line 105)
  • access: public
static void calculateCSRFParams ()
static method exposedProperties (line 117)
  • access: public
static void exposedProperties ()

Redefinition of:
WFWidget::exposedProperties()

Redefined in descendants as:
Constructor __construct (line 74)

Constructor.

Sets up the smarty object for this module.

WFForm __construct ( $id,  $page)
  • $id
  • $page

Redefinition of:
WFWidget::__construct()
Constructor.

Redefined in descendants as:
addChild (line 127)
void addChild (WFView $view)

Redefinition of:
WFView::addChild()
Add a child view to this view.
allConfigFinishedLoading (line 146)
void allConfigFinishedLoading ()

Redefinition of:
WFView::allConfigFinishedLoading()
After WFPage has completed the loading of all config for all widgets, it will call this function on each widget.
canPushValueBinding (line 236)
void canPushValueBinding ()

Redefinition of:
WFWidget::canPushValueBinding()
Does this widget use the "value" binding to WRITE data back to the bindings?

Redefined in descendants as:
defaultSubmitID (line 176)
void defaultSubmitID ()
isAjax (line 166)
void isAjax ()
phocoaFormParameters (line 112)
  • access: public
void phocoaFormParameters ()
render (line 191)
void render ([ $blockContent = NULL])
  • $blockContent

Redefinition of:
WFView::render()
Render the view into HTML.

Redefined in descendants as:
setAction (line 181)
void setAction ( $action)
  • $action
setIsAjax (line 171)
void setIsAjax ( $b)
  • $b
setMethod (line 186)
void setMethod ( $method)
  • $method

Inherited Methods

Inherited From WFWidget

WFWidget::__construct()
WFWidget::addError()
WFWidget::bind()
WFWidget::bindingByName()
WFWidget::bindings()
WFWidget::canPushValueBinding()
WFWidget::errors()
WFWidget::exposedBindings()
WFWidget::exposedProperties()
WFWidget::formattedValue()
WFWidget::formatter()
WFWidget::hasRestoredState()
WFWidget::hidden()
WFWidget::name()
WFWidget::processBindingOptions()
WFWidget::propagateValueToBinding()
WFWidget::pullBindings()
WFWidget::pushBindings()
WFWidget::restoreState()
WFWidget::setFormatter()
WFWidget::setHidden()
WFWidget::setName()
WFWidget::setupExposedBindings()
WFWidget::setValue()
WFWidget::setWidgetLabel()
WFWidget::unbind()
WFWidget::value()
WFWidget::valueForBinding()
WFWidget::widgetLabel()

Inherited From WFView

WFView::__construct()
WFView::addChild()
WFView::allConfigFinishedLoading()
WFView::children()
WFView::cloneWithID()
WFView::enabled()
WFView::exposedProperties()
WFView::getForm()
WFView::getJSActions()
WFView::getListenerJS()
WFView::getListenerJSInScriptTag()
WFView::getWidgetDir()
WFView::getWidgetWWWDir()
WFView::id()
WFView::importCSS()
WFView::importJS()
WFView::jsEndHTML()
WFView::jsStartHTML()
WFView::page()
WFView::parent()
WFView::removeChild()
WFView::render()
WFView::setEnabled()
WFView::setId()
WFView::setJSonBlur()
WFView::setJSonClick()
WFView::setListener()
WFView::setOnEvent()
WFView::setParent()
WFView::yuiPath()

Inherited From WFObject

WFObject::__construct()
WFObject::exposedProperties()
WFObject::getClass()
WFObject::keyPathToTargetAndKey()
WFObject::setValueForKey()
WFObject::setValueForKeyPath()
WFObject::validateValueForKey()
WFObject::validateValueForKeyPath()
WFObject::valueForKey()
WFObject::valueForKeyPath()
WFObject::valueForUndefinedKey()
WFObject::__toString()
Class Constants
CALCULATED_DEFAULT_SUBMIT_ID_CANNOT_DETERMINE = -1 (line 55)
CALCULATED_DEFAULT_SUBMIT_ID_NONE = NULL (line 54)
METHOD_GET = 'get' (line 35)
METHOD_POST = 'post' (line 39)

Documentation generated on Thu, 17 Apr 2008 13:51:44 -0400 by phpDocumentor 1.4.1