Form
Form implements OutputableInterface
Form
- Full name: \Gibbon\Forms\Form
- This class implements: Warning: strrchr() expects parameter 1 to be string, object given in /Users/sankuipe/Desktop/Localhost/documentor/src/Extension/TwigMarkdownAnchorLink.php on line 108
Example
<?php
$form = Form::create('action', $_SESSION[$guid]['absoluteURL'].'/modules/'.$_SESSION[$guid]['module'].'/thing.php');
$form->addHiddenValue('address', $_SESSION[$guid]['address']);
$row = $form->addRow();
$row->addFooter();
$row->addSubmit();
echo $form->getOutput();
Methods
- __construct — Create a form with a specific factory and renderer.
- create — Create a form with the default factory and renderer.
- getFactory — Get the current factory.
- setFactory — Set the factory.
- getRenderer — Get the current renderer.
- setRenderer — Set the renderer.
- getMethod — Get the current HTTP method for this form (default: post)
- getAction — Get the current action URL for the form.
- addRow — Adds a Row object to the form and returns it.
- getRow — Cet the last added Row object, null if none exist.
- getRows — Get an array of all Row objects in the form.
- addHiddenValue — Adds an input type=hidden value to the form.
- getHiddenValues — Get an array of all hidden values.
- getAutocomplete — Get the value of the autocomplete HTML form attribute.
- setAutocomplete — Turn autocomplete for the form On or Off.
- addConfirmation — Add a confirmation message to display before form submission.
- addTrigger — Adds a Trigger object that injects javascript to respond to form events.
- getTriggers — Get an array of all Trigger objects.
- toggleVisibilityByClass — Adds a visibility trigger to the form by class name.
- toggleVisibilityByID — Adds a visibility trigger to the form by element ID.
- loadAllValuesFrom — Loads an array of $key => $value pairs into any form elements with a matching name.
- loadStateFrom — Loads the state for several form elements by calling $method with values from $data.
- getOutput — Renders the form to HTML.
Inherited from BasicAttributesTrait
- setID
- getID
- setTitle
- getTitle
- setClass
- addClass
- removeClass
- getClass
- addData
- getData
- getAttributeString
__construct
Create a form with a specific factory and renderer.
Form::__construct( \Gibbon\Forms\FormFactoryInterface $factory, \Gibbon\Forms\FormRendererInterface $renderer, string $action, string $method )
create
Create a form with the default factory and renderer.
static Form::create( string $id, string $action, string $method = 'post', string $class = 'smallIntBorder fullWidth standardForm' ): object
- This method is static.
Return Value:
object
Form object
getFactory
Get the current factory.
Form::getFactory( ): object
Return Value:
object
FormFactoryInterface
setFactory
Set the factory.
Form::setFactory( \Gibbon\Forms\FormFactoryInterface $factory )
getRenderer
Get the current renderer.
Form::getRenderer( ): object
Return Value:
object
FormRendererInterface
setRenderer
Set the renderer.
Form::setRenderer( \Gibbon\Forms\FormRendererInterface $renderer )
getMethod
Get the current HTTP method for this form (default: post)
Form::getMethod( ): string
Return Value:
string
getAction
Get the current action URL for the form.
Form::getAction( ): string
Return Value:
string
addRow
Adds a Row object to the form and returns it.
Form::addRow( string $id = '' ): object
Return Value:
object
Row
getRow
Cet the last added Row object, null if none exist.
Form::getRow( ): object|null
Return Value:
object|null
getRows
Get an array of all Row objects in the form.
Form::getRows( ): array
Return Value:
array
addHiddenValue
Adds an input type=hidden value to the form.
Form::addHiddenValue( string $name, string $value )
getHiddenValues
Get an array of all hidden values.
Form::getHiddenValues( ): array
Return Value:
array
getAutocomplete
Get the value of the autocomplete HTML form attribute.
Form::getAutocomplete( ): string
Return Value:
string
setAutocomplete
Turn autocomplete for the form On or Off.
Form::setAutocomplete( string $value ): self
Returns Self: This method can be chained.
addConfirmation
Add a confirmation message to display before form submission.
Form::addConfirmation( string $message ): self
Returns Self: This method can be chained.
addTrigger
Adds a Trigger object that injects javascript to respond to form events.
Form::addTrigger( string $selector, object $trigger )
getTriggers
Get an array of all Trigger objects.
Form::getTriggers( ): array
Return Value:
array
toggleVisibilityByClass
Adds a visibility trigger to the form by class name.
Form::toggleVisibilityByClass( string $class ): object
Return Value:
object
Trigger
toggleVisibilityByID
Adds a visibility trigger to the form by element ID.
Form::toggleVisibilityByID( string $id ): object
Return Value:
object
Trigger
loadAllValuesFrom
Loads an array of $key => $value pairs into any form elements with a matching name.
Form::loadAllValuesFrom( &$data ): self
Returns Self: This method can be chained.
loadStateFrom
Loads the state for several form elements by calling $method with values from $data.
Form::loadStateFrom( string $method, array &$data ): void
getOutput
Renders the form to HTML.
Form::getOutput( ): string
Return Value:
string