public
|
#
__construct( flRequest $request, string $name, string $action, boolean $post = true, flFormDecoratorList $frmDecorators = null, flFormDecoratorList $grpDecorators = null, flFormDecoratorList $elemDecorators = null )
Construct and initialise the form.
Construct and initialise the form.
Parameters
- $request
- The request object.
- $name
- The name of the form.
- $action
- The action or URI to send the form submission to.
- $post
- true if the form should be submitted with POST or false for GET
- $frmDecorators
- Optional decorators for the form.
- $grpDecorators
- Optional default decorators for groups.
- $elemDecorators
- Optional default decorators for group elements.
|
public
flForm
|
#
addElement( flFormElement $elem )
Add a form element to the form.
Add a form element to the form.
Parameters
- $elem
- The form element to add.
Returns
|
public
flFormElement
|
#
getElement( string $name )
Get the nameed element.
Parameters
- $name
- The name of the element to get.
Returns
|
public
flForm
|
#
groupElements( string $name, array $elements, flFormDecoratorList $grpDecorators = null, flFormDecoratorList $elemDecorators = null )
Group elements, the elements must already be added.
Group elements, the elements must already be added.
Parameters
- $name
- The name of the group.
- $elements
- The list of elements to put in the group.
- $grpDecorators
- Optional decorators for the group.
- $elemDecorators
- Optional decorators for the group elements.
Returns
Throws
|
public
boolean
|
#
hasGroup( string $name )
Test if the form has a group of the given name.
Test if the form has a group of the given name.
Parameters
- $name
- The name of the group to add.
Returns
boolean true if the group is present; else false
|
public
flForm
|
#
addToGroup( string $element, flFormElement $name )
Add element to an existing group.
Add element to an existing group.
Parameters
- $element
- $name The name of the group.
- $name
- $element The element to put in the group.
Returns
Throws
|
public
flForm
|
#
addTab( string $label, array $groups )
Add a tab containing the specified groups.
Add a tab containing the specified groups.
Parameters
- $label
- The label for the tab.
- $groups
- Array of groups names to add to the tab, or single group name.
Returns
|
public
flFrom
|
#
setGroupLabel( string $name, string $label )
Set the label for a group.
Set the label for a group.
Parameters
- $name
- The name of the group to set the label for or null for the default.
- $label
- The HTML formatted label for the group.
Returns
flFrom This object
|
public
boolean
|
#
isSubmitted( )
Get if the form has been submitted.
Get if the form has been submitted.
If an AJAX validation request is detected then the response is sent back and
the function never returns.
Returns
boolean true if the form has been submitted else false.
|
public
boolean
|
#
isValid( )
Test if the form and its elements are valid.
Test if the form and its elements are valid.
Returns
boolean true if the form and its elements are valid; else false.
true is also returned if isSubmitted() returns false.
|
public
boolean
|
#
isInvalidated( )
Test if the form has been invalidated by one of the elements changing state from
valid to invalid.
Test if the form has been invalidated by one of the elements changing state from
valid to invalid.
Returns
boolean true if the form has been invalidated; else false.
|
public
|
#
setAJAXWaitText( string $text )
Set the text to use for AJAX waiting messages.
Set the text to use for AJAX waiting messages.
Parameters
|
public
|
#
setAJAXFailText( string $text )
Set the text to use for the AJAX failed message.
Set the text to use for the AJAX failed message.
Parameters
|
public
|
#
setOnSubmitJS( string $js )
Set the JavaScript to run on form submit, if the function returns false then
the form is not submitted.
Set the JavaScript to run on form submit, if the function returns false then
the form is not submitted.
Parameters
- $js
- The JavaScript to run on form submit.
|
public
|
#
focusElement( flFormElement $elem )
The element to set focus to.
The element to set focus to.
Parameters
- $elem
- The element to focus by default.
|
public
string
|
#
getFormTagAttr( )
Get the form tag attributes, used by decorators to open the form.
Get the form tag attributes, used by decorators to open the form.
Returns
string The form open tag.
|
public
|
#
setCSS( string $class )
Set the CSS class for the form.
Set the CSS class for the form.
Parameters
- $class
- The class name of null for no class.
|
public
|
#
showOnlyErrors( boolean $showOnlyErrors = true )
Flags if to only show validation errors rather than also showing a message for valid fields.
Flags if to only show validation errors rather than also showing a message for valid fields.
Parameters
- $showOnlyErrors
- true, the default, shows only errors or false to show errors and valid fields.
|
public
boolean
|
#
getShowOnlyErrors( )
Get if showing only errors on validation.
Get if showing only errors on validation.
Returns
boolean true if showing only errors; else false.
|
public
flRequest
|
#
getRequest( )
Get the forms request object.
Get the forms request object.
Returns
|
public
|
#
setRequiredText( string $required )
Set the decoration to apply to required elements, default is '(Required)'.
Set the decoration to apply to required elements, default is '(Required)'.
Parameters
- $required
- The decoration text.
|
public
string
|
#
getRequiredText( )
Get the decoration to apply to required elements.
Get the decoration to apply to required elements.
Returns
string The required text.
|
public
|
#
setValidText( string $text )
Set the text to return with getError() for valid elements.
Set the text to return with getError() for valid elements.
Parameters
|
public
string
|
#
getValidText( )
Get the text for valid elements.
Get the text for valid elements.
Returns
string The valid string.
|
public
flBufferCode
|
#
getCodeBuffer( )
Get the code buffer being used during rendering.
Get the code buffer being used during rendering.
Returns
|
public
string
|
#
render( flBufferCode $codeBuffer = null )
Render the form.
If an AJAX validation request is detected then it is replied to
and the function never returns.
Parameters
- $codeBuffer
- The optional code buffer helper if not given then JavaScript is put inline.
Returns
string The HTML for the form.
See
|
public
string
|
#
getName( )
Get the form name.
Returns
string The name of the form.
|