Public Member Functions
Form Class Reference

Html form wrapper. More...

Inheritance diagram for Form:
Tag

Public Member Functions

 Form ($method= 'post', $action= '')
 
 setAction ($action)
 
 enableUpload ()
 
 create ()
 
 end ()
 
 inputTag ($type)
 
 input ($type, $name, $value=null)
 
 inputSet ($type, $name, $values)
 
 textarea ($name, $content=null)
 
 select ($name, $options=array(), $selected= '')
 
 label ($content, $field, $customid=null)
 
 submit ($value= 'Submit', $attributes=array())
 
- Public Member Functions inherited from Tag
 Tag ($type, $attributes=array())
 
 getType ()
 
 getAttribute ($name)
 
 getAttributes ()
 
 hasAttribute ($name)
 
 setAttribute ($attribute, $value= '')
 
 append ($content=array())
 
 appendTo (Tag $tag)
 
 getChildren ()
 
 html ($indent=-1)
 
 indent ($indent=-1)
 
 __toString ()
 

Additional Inherited Members

- Static Public Member Functions inherited from Tag
static newInstance ($type, $attributes=array())
 
- Data Fields inherited from Tag
 $type
 
 $attributes = array()
 
 $content = array()
 

Detailed Description

Html form wrapper.

Version
1.2
Author
DinuSV

Member Function Documentation

Form (   $method = 'post',
  $action = '' 
)

Constructor

Parameters
string$method: [optional] post/get
string$action: [optional] form action
setAction (   $action)

Set the action for the form

Parameters
string$action
Returns
Form : current object
enableUpload ( )

Enable file uploading for this form

Returns
Form : current object
create ( )

Create the form

Returns
string : open form tag
end ( )

Close the form

Returns
string : form closure
inputTag (   $type)

Create an input tag by specifying it's type

Parameters
string$type
Returns
Tag
input (   $type,
  $name,
  $value = null 
)

Create input tag by type, name and value

Parameters
string$type
string$name
string$value: [optional]
Returns
Tag
inputSet (   $type,
  $name,
  $values 
)

Create a set of input tags

Parameters
string$type
string$name
array$values: in case values is a string, the standard input method will be called
Returns
array : array of Tag types
textarea (   $name,
  $content = null 
)

Create a textarea tag

Parameters
string$name
string$content: [optional]
array$content: [optional] array of Tags
Returns
Tag
select (   $name,
  $options = array(),
  $selected = '' 
)

Create a select Tag

Parameters
string$name
array$options: [optional] list of options for the selection. Each key of the array is the value given to the option and each value will be the content for the option tag.
string$selected: set one of the options to be selected by default, The $selected value has to be equal to the key for the option
Returns
Tag
label (   $content,
  $field,
  $customid = null 
)

Create a label for an input field

Parameters
string$content: label content
mixed$field: the field this label is for, can be either a given tag, or a string representing the id of the field. If the field is a Tag object, then a default id will be generated containing the 'field-' string and it's name.
string$customid: [optional] If this value is present, then a custom id will be generated for the $field Tag
Returns
Tag
submit (   $value = 'Submit',
  $attributes = array() 
)

Create a submit button

Parameters
string$value: [optional]
array$attributes: custom attributes for this submit button
Returns
Tag