Jump to content

auForm: Difference between revisions

From auWiki
New page: {{RightTOC}} The auForm class is part of the auLib package. Its purpose is to build form objects that can be used to output HTML and perform simple user input valida...
 
No edit summary
Line 1: Line 1:
{{RightTOC}}
{{RightTOC}}
The auForm class is part of the [[PHP Package auLib|auLib]] package.  Its purpose is to build form objects that can be used to output HTML and perform simple user input validation.  It also attempts to fool spammers using a couple methods which should be undetectable by actual people.
The auForm class is part of the [[PHP Package auLib|auLib]] package.  Its purpose is to build form objects that can be used to output HTML and perform simple user input validation.  It also attempts to fool spammers using a couple methods which should be undetectable by actual people.  The included auForm.css should be integrated into sites using auForm in order to make sure the spam trap fields do not get seen by actual people.


==Usage==
==Usage==

Revision as of 23:14, 31 January 2007

The auForm class is part of the auLib package. Its purpose is to build form objects that can be used to output HTML and perform simple user input validation. It also attempts to fool spammers using a couple methods which should be undetectable by actual people. The included auForm.css should be integrated into sites using auForm in order to make sure the spam trap fields do not get seen by actual people.

Usage

Create a form using new auForm(), then build it using AddFieldSet(), AddData(), AddText(), AddField(), AddSelect(), AddMultiSelect(), and AddButtons(). Check Submitted() to see if the form was submitted, or to find out which submit button was used. Use CheckInput() to automatically validate fields. Use WriteHTML() to write out HTML code for the form. If any errors were found during CheckInput(), they will display above the problematic field.

Constants

Field Types

  • _AU_FORM_FIELD_NORMAL
  • _AU_FORM_FIELD_NUMERIC
  • _AU_FORM_FIELD_INTEGER
  • _AU_FORM_FIELD_DATETIME
  • _AU_FORM_FIELD_MULTILINE
  • _AU_FORM_FIELD_BBCODE
  • _AU_FORM_FIELD_PASSWORD
  • _AU_FORM_FIELD_CHECKBOX
  • _AU_FORM_FIELD_FILE

Select Types

  • _AU_FORM_SELECT_DROPDOWN
  • _AU_FORM_SELECT_RADIO

MultiSelect Types

  • _AU_FORM_MULTI_LIST
  • _AU_FORM_MULTI_CHECK

Public Functions

Emphasized parameters are optional.

new auForm

new auForm($id, $action, $method)

AddFieldSet

AddFieldSet($fieldset)

AddData

AddData($name, $value)

AddText

AddText($title, $text)

AddHTML

AddHTML($title, $html)

AddField

AddField($name, $label, $tooltip, $required, $default, $type, $width, $maxlength)

AddSelect

AddSelect($name, $label, $tooltip, $values, $default, $type)

AddMultiSelect

AddMultiSelect($name, $label, $tooltip, $values, $default, $type)

AddButtons

AddButtons($text, $tooltip, $name)

WriteHTML

WriteHTML($trusted, $indent)

Submitted

Submitted()

CheckInput

CheckInput($trusted)

Private Functions

StartTable

StartTable()

EndTable

EndTable()

StartRow

StartRow($required, $th)

EndRow

EndRow()