PHP Class SimpleForm, simpletest

Afficher le fichier Open project: simpletest/simpletest Class Usage Examples

Méthodes publiques

Méthode Description
__construct ( SimpleTag $tag, SimplePage $page ) Starts with no held controls/widgets.
addWidget ( SimpleWidget $tag ) Adds a tag contents to the form.
attachLabelBySelector ( SelectorInterface $selector, $label ) Used by the page object to set widgets labels to external label tags.
getAction ( ) : SimpleUrl Absolute URL of the target.
getId ( ) : string ID field of form for unique identification.
getMethod ( ) : string Accessor for method of form submission.
getValue ( SelectorInterface $selector ) : string/array Extracts current value from form.
hasImage ( SelectorInterface $selector ) : boolean Test to see if a form has an image control.
hasSubmit ( SelectorInterface $selector ) : boolean Test to see if a form has a submit button.
setDefaultTarget ( string $frame ) Sets the frame target within a frameset.
setField ( SelectorInterface $selector, string $value, $position = false ) : boolean Sets a widget value within the form.
submit ( $additional = false ) : hash Simply submits the form without the submit button value.
submitButton ( SelectorInterface $selector, hash $additional = false ) : SimpleEncoding Gets the submit values for a selected button.
submitImage ( SelectorInterface $selector, integer $x, integer $y, hash $additional = false ) : SimpleEncoding Gets the submit values for an image.

Méthodes protégées

Méthode Description
addCheckbox ( SimpleCheckboxTag $tag ) Adds a checkbox, making it a group on a repeated name.
addRadioButton ( SimpleRadioButtonTag $tag ) Adds a radio button, building a group if necessary.
createAction ( string $action, $page ) : SimpleUrl Combined action attribute with current location to get an absolute form target.
encode ( ) : SimpleFormEncoding Creates the encoding for the current values in the form.
setEncodingClass ( SimpleTag $tag ) : string Creates the request packet to be sent by the form.
setWidget ( SimpleWidget $tag ) Sets the widget into the form, grouping radio buttons if any.

Method Details

__construct() public méthode

Starts with no held controls/widgets.
public __construct ( SimpleTag $tag, SimplePage $page )
$tag SimpleTag Form tag to read.
$page SimplePage Holding page.

addCheckbox() protected méthode

Adds a checkbox, making it a group on a repeated name.
protected addCheckbox ( SimpleCheckboxTag $tag )
$tag SimpleCheckboxTag Incoming form control.

addRadioButton() protected méthode

Adds a radio button, building a group if necessary.
protected addRadioButton ( SimpleRadioButtonTag $tag )
$tag SimpleRadioButtonTag Incoming form control.

addWidget() public méthode

Adds a tag contents to the form.
public addWidget ( SimpleWidget $tag )
$tag SimpleWidget Input tag to add.

attachLabelBySelector() public méthode

Used by the page object to set widgets labels to external label tags.
public attachLabelBySelector ( SelectorInterface $selector, $label )
$selector SelectorInterface Criteria to apply.

createAction() protected méthode

Combined action attribute with current location to get an absolute form target.
protected createAction ( string $action, $page ) : SimpleUrl
$action string Action attribute from form tag.
$page Page location.
Résultat SimpleUrl Absolute form target.

encode() protected méthode

Creates the encoding for the current values in the form.
protected encode ( ) : SimpleFormEncoding
Résultat SimpleFormEncoding Request to submit.

getAction() public méthode

Absolute URL of the target.
public getAction ( ) : SimpleUrl
Résultat SimpleUrl URL target.

getId() public méthode

ID field of form for unique identification.
public getId ( ) : string
Résultat string Unique tag ID.

getMethod() public méthode

Accessor for method of form submission.
public getMethod ( ) : string
Résultat string Either get or post.

getValue() public méthode

Extracts current value from form.
public getValue ( SelectorInterface $selector ) : string/array
$selector SelectorInterface Criteria to apply.
Résultat string/array

hasImage() public méthode

Test to see if a form has an image control.
public hasImage ( SelectorInterface $selector ) : boolean
$selector SelectorInterface Criteria to apply.
Résultat boolean True if present.

hasSubmit() public méthode

Test to see if a form has a submit button.
public hasSubmit ( SelectorInterface $selector ) : boolean
$selector SelectorInterface Criteria to apply.
Résultat boolean True if present.

setDefaultTarget() public méthode

Sets the frame target within a frameset.
public setDefaultTarget ( string $frame )
$frame string Name of frame.

setEncodingClass() protected méthode

Creates the request packet to be sent by the form.
protected setEncodingClass ( SimpleTag $tag ) : string
$tag SimpleTag Form tag to read.
Résultat string Packet class.

setField() public méthode

Sets a widget value within the form.
public setField ( SelectorInterface $selector, string $value, $position = false ) : boolean
$selector SelectorInterface Criteria to apply.
$value string Value to input into the widget.
Résultat boolean True if value is legal, false otherwise. If the field is not present, nothing will be set.

setWidget() protected méthode

Sets the widget into the form, grouping radio buttons if any.
protected setWidget ( SimpleWidget $tag )
$tag SimpleWidget Incoming form control.

submit() public méthode

Used when there is only one button or it is unimportant.
public submit ( $additional = false ) : hash
Résultat hash Submitted values.

submitButton() public méthode

Gets the submit values for a selected button.
public submitButton ( SelectorInterface $selector, hash $additional = false ) : SimpleEncoding
$selector SelectorInterface Criteria to apply.
$additional hash Additional data for the form.
Résultat SimpleEncoding Submitted values or false if there is no such button in the form.

submitImage() public méthode

Gets the submit values for an image.
public submitImage ( SelectorInterface $selector, integer $x, integer $y, hash $additional = false ) : SimpleEncoding
$selector SelectorInterface Criteria to apply.
$x integer X-coordinate of click.
$y integer Y-coordinate of click.
$additional hash Additional data for the form.
Résultat SimpleEncoding Submitted values or false if there is no such button in the form.