Form Class Reference

Builds XForm in PHP This class allows you to build an xform in php. In order to build a form, you can use addInput to add each element of the form, then use buildForm to put everything together. More...

Inheritance diagram for Form:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 add ($input)
 Add a form input object that was built and passed in.
 addDateChooser ($label, $ref="", $required="", $value="", $appearance="minimal", $description="")
 Add a date chooser input to this Form.
 addDayChooser ($label, $ref="", $required="", $value="", $appearance="", $description="")
 Add a day chooser input to this Form.
 addInput ($inputType, $label, $ref="", $validType="", $required="", $value="", $items="", $appearance="", $description="")
 Add an input to this Form.
 addMonthChooser ($label, $ref="", $required="", $value="", $appearance="", $description="")
 Add a month chooser input to this Form.
 addText ($label, $description="")
 Add a "text" input to this Form.
 addTextarea ($label, $ref="", $validType="", $required="", $value="", $items="", $appearance="", $description="")
 Add a "textarea" input to this Form.
 addYearChooser ($label, $ref="", $required="", $value="", $appearance="", $description="")
 Add a year chooser input to this Form.
 buildForm ($submitLabel)
 Return the XML representation of this Form.
 setTopSubmit ($topSubmit)
 Add a submit button at the top of the Form.
 setYears ($numYears="", $startYear="")
 Set the year range for year chooser inputs.


Detailed Description

Builds XForm in PHP This class allows you to build an xform in php. In order to build a form, you can use addInput to add each element of the form, then use buildForm to put everything together.

Author:
Valerie Gartland (<valerie@shodor.org>)

Member Function Documentation

Form::addDateChooser ( label,
ref = "",
required = "",
value = "",
appearance = "minimal",
description = "" 
)

Add a date chooser input to this Form.

This allows you to add an input for choosing a date. If you want to define a default value, it must be of the format YYYY-MM-DD.

Form::addDayChooser ( label,
ref = "",
required = "",
value = "",
appearance = "",
description = "" 
)

Add a day chooser input to this Form.

This allows you to add an input for choosing a day.

Form::addInput ( inputType,
label,
ref = "",
validType = "",
required = "",
value = "",
items = "",
appearance = "",
description = "" 
)

Add an input to this Form.

This allows you to add different elements to the form. For every element you add, an entry will be added to the model section of the xform as well as to the control part. A "text" type is the only kind of input that will not have an entry in the model section, since it is only a description and does not require any input.

Parameters:
$inputType [string]: the type of input (can be 'input', 'textarea', 'select', 'select1', 'secret', 'title')
$label [string]: the label that will be displayed with the input
$ref [string]: the reference for the input (used for reading values from the xform)
$validType [string]: validation type for this input (from SValidation)
$required [bool]: whether or not this input is a required element of the form
$value [mixed]: the default value of the input (optional)
$items [array]: the list of choices for a dropdown box or set of check boxes
$appearance [string]: the appearance of the input (can be 'minimal', 'compact', 'full')
$description [string]: a description for the input

Form::addMonthChooser ( label,
ref = "",
required = "",
value = "",
appearance = "",
description = "" 
)

Add a month chooser input to this Form.

This allows you to add an input for choosing a month.

Form::addText ( label,
description = "" 
)

Add a "text" input to this Form.

This allows you to add a "text" input to the form without having to mess with the other parameters that text inputs don't have.

Form::addTextarea ( label,
ref = "",
validType = "",
required = "",
value = "",
items = "",
appearance = "",
description = "" 
)

Add a "textarea" input to this Form.

This allows you to add a "textarea" input to the form.

Form::addYearChooser ( label,
ref = "",
required = "",
value = "",
appearance = "",
description = "" 
)

Add a year chooser input to this Form.

This allows you to add an input for choosing a year.

Form::buildForm ( submitLabel  ) 

Return the XML representation of this Form.

This function will return a string representing the xform you built. The submission button will have whatever label you pass in.

Returns:
[string]: XML representation of this Form

Form::setTopSubmit ( topSubmit  ) 

Add a submit button at the top of the Form.

If you pass in true, there will be a submit button at the top.

Form::setYears ( numYears = "",
startYear = "" 
)

Set the year range for year chooser inputs.

Sets the years that will be available in the year chooser. The default is to start with the year before the current year and go through 5 years.

Parameters:
$numYears [int]: The number of years displayed by the year chooser inputs
$startYear [int]: The starting year for year chooser inputs


The documentation for this class was generated from the following file:

Generated on Wed Nov 24 02:02:21 2010 for Common by  doxygen 1.5.6