phpDocumentor pivotx
[ class tree: pivotx ] [ index: pivotx ] [ all elements ]

Class: Form

Source Location: /modules/formclass.php

Class Form

Property Summary
mixed   $fields  
mixed   $formname  
mixed   $hidden_fields  
mixed   $html  
mixed   $lastuploadfile  
mixed   $submitloc  
mixed   $tabindex  
mixed   $uploads  
mixed   $upload_success  
mixed   $use_javascript  

[ Top ]
Method Summary
void   add()   Add a field (or header) to the form. See the readme for information about the format of the array to pass.
void   add_select_sort()   add_select_sort
void   clearerror()   Clear (remove) an error from a certain field
void   clearpost()  
void   defaultfield()   Sets the default values for a new field. If we're lazy with regard to setting the form fields, we will assume these sensible defaults.
void   display()   Fetch the form output as HTML, and pass it to the browser.
void   fetch()   Fetch the form output as HTML, and return it.
void   form()  
array   geterrors()   Return an array with the fields that have an error.
void   getvalues()  
bool   handleUpload()   Upload files in a directory.
void   init_html()   Initialise the XHTML snippets to be used for generating the forms.
void   remove()   Remove a field from the form.
void   renderfield()   This function renders a single field. Normally you don't need to call this function manually
void   seterror()   Trigger an error in a field
void   setvalue()  
void   setvalues()  
void   submitlocation()  
void   use_javascript()   Set whether or not to use javascript validation.
integer   validate()   Validate the form using the set criteria.
string   _fetch_script()   Compile the javascript to use for client-side validation, in addition to the server-side validation.
string   _getExtension()   Gets the extension (if any) of a filename.
boolean   _isEmail()   Checks if the text is a valid email address.
void   _safeString()  
string   _script_criterium()   Get the values to use in javascript validation.
boolean   _validate_criterium()   Validate a single criteria in a certain field
integer   _validate_field()   Validate a certain field..

[ Top ]
Properties
mixed   $fields = array() [line 37]

[ Top ]
mixed   $formname = "" [line 39]

[ Top ]
mixed   $hidden_fields = array() [line 38]

[ Top ]
mixed   $html = array() [line 36]

[ Top ]
mixed   $lastuploadfile = '' [line 41]

[ Top ]
mixed   $submitloc = " bottom" [line 44]

[ Top ]
mixed   $tabindex = 500 [line 45]

[ Top ]
mixed   $uploads = array() [line 43]

[ Top ]
mixed   $upload_success = false [line 40]

[ Top ]
mixed   $use_javascript = false [line 42]

[ Top ]
Methods
add  [line 99]

  void add( array $params  )

Add a field (or header) to the form. See the readme for information about the format of the array to pass.

Parameters:
array   $params: 


[ Top ]
add_select_sort  [line 1369]

  void add_select_sort( $a, $b  )

add_select_sort

Parameters:
   $a: 
   $b: 


[ Top ]
clearerror  [line 765]

  void clearerror( string $name  )

Clear (remove) an error from a certain field

Parameters:
string   $name: 


[ Top ]
clearpost  [line 1162]

  void clearpost( )



[ Top ]
defaultfield  [line 170]

  void defaultfield( string $fieldtype, $name, [ $sessionvariable = ""]  )

Sets the default values for a new field. If we're lazy with regard to setting the form fields, we will assume these sensible defaults.

Parameters:
string   $fieldtype: 
   $name: 
   $sessionvariable: 


[ Top ]
display  [line 263]

  void display( [boolean $skip_submit = false]  )

Fetch the form output as HTML, and pass it to the browser.

Parameters:
boolean   $skip_submit: 


[ Top ]
fetch  [line 274]

  void fetch( [boolean $skip_submit = false]  )

Fetch the form output as HTML, and return it.

Parameters:
boolean   $skip_submit: 


[ Top ]
form  [line 50]

  void form( $name, [ $action = ""], [ $submit = "Submit"]  )

Parameters:
   $name: 
   $action: 
   $submit: 


[ Top ]
geterrors  [line 811]

  array geterrors( )

Return an array with the fields that have an error.



[ Top ]
getvalues  [line 1092]

  void getvalues( )



[ Top ]
handleUpload  [line 1257]

  bool handleUpload( $pFile $pFile, [$pDirectory $pDirectory = './'], [$pMaxFileSize $pMaxFileSize = 2048], $pAllowedTypes, $pFieldName  )

Upload files in a directory.

Parameters:
$pFile   $pFile:  File to upload.
$pDirectory   $pDirectory:  Upload directory.
$pMaxFileSize   $pMaxFileSize:  Maximum filesize. Default value = 2048 kb.
   $pAllowedTypes: 
   $pFieldName: 


[ Top ]
init_html  [line 82]

  void init_html( )

Initialise the XHTML snippets to be used for generating the forms.



[ Top ]
remove  [line 153]

  void remove( string $name  )

Remove a field from the form.

Parameters:
string   $name: 


[ Top ]
renderfield  [line 435]

  void renderfield( string $field  )

This function renders a single field. Normally you don't need to call this function manually

Parameters:
string   $field: 

API Tags:
See:  render


[ Top ]
seterror  [line 746]

  void seterror( string $name, [string $error = ""]  )

Trigger an error in a field

Parameters:
string   $name: 
string   $error: 


[ Top ]
setvalue  [line 1142]

  void setvalue( $fieldname, $value  )

Parameters:
   $fieldname: 
   $value: 


[ Top ]
setvalues  [line 1117]

  void setvalues( $values  )

Parameters:
   $values: 


[ Top ]
submitlocation  [line 1167]

  void submitlocation( $str  )

Parameters:
   $str: 


[ Top ]
use_javascript  [line 1362]

  void use_javascript( boolean $val  )

Set whether or not to use javascript validation.

Parameters:
boolean   $val: 


[ Top ]
validate  [line 781]

  integer validate( )

Validate the form using the set criteria.



[ Top ]
_fetch_script  [line 333]

  string _fetch_script( )

Compile the javascript to use for client-side validation, in addition to the server-side validation.

This generates a piece of javascript that uses Jquery and the validation plugin to do the nitty-gritty.

Note: Not all fields and not all validation criteria work (yet)


API Tags:
See:  http://bassistance.de/jquery-plugins/jquery-plugin-validation/
See:  http://jquery.com


[ Top ]
_getExtension  [line 1415]

  string _getExtension( string $file  )

Gets the extension (if any) of a filename.

Parameters:
string   $file: 


[ Top ]
_isEmail  [line 1194]

  boolean _isEmail( string $theAdr  )

Checks if the text is a valid email address.

Given a chain it returns true if $theAdr conforms to RFC 2822. It does not check the existence of the address. Suppose a mail of the form

  addr-spec     = local-part "@" domain
  local-part    = dot-atom / quoted-string / obs-local-part
  dot-atom      = [CFWS] dot-atom-text [CFWS]
  dot-atom-text = 1*atext *("." 1*atext)
  atext         = ALPHA / DIGIT /    ; Any character except controls,
        "!" / "#" / "$" / "%" /      ;  SP, and specials.
        "&" / "'" / "*" / "+" /      ;  Used for atoms
        "-" / "/" / "=" / "?" /
        "^" / "_" / "`" / "{" /
        "|" / "}" / "~" / "." /

Parameters:
string   $theAdr: 


[ Top ]
_safeString  [line 1385]

  void _safeString( $str, [ $strict = FALSE]  )

Parameters:
   $str: 
   $strict: 


[ Top ]
_script_criterium  [line 989]

  string _script_criterium( string $criterium  )

Get the values to use in javascript validation.

Parameters:
string   $criterium: 


[ Top ]
_validate_criterium  [line 875]

  boolean _validate_criterium( string $criterium, mixed $value  )

Validate a single criteria in a certain field

Parameters:
string   $criterium: 
mixed   $value: 


[ Top ]
_validate_field  [line 832]

  integer _validate_field( string $key, $string $field  )

Validate a certain field..

Parameters:
string   $key: 
$string   $field: 


[ Top ]

Documentation generated on Thu, 17 May 2012 01:07:10 +0200 by phpDocumentor 1.4.3