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
Form   __construct()  
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.
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
Constructor __construct  [line 50]

  Form __construct( $name, [ $action = ""], [ $submit = "Submit"]  )

Parameters:
   $name: 
   $action: 
   $submit: 


[ Top ]
add  [line 100]

  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 1357]

  void add_select_sort( $a, $b  )

add_select_sort

Parameters:
   $a: 
   $b: 


[ Top ]
clearerror  [line 766]

  void clearerror( string $name  )

Clear (remove) an error from a certain field

Parameters:
string   $name: 


[ Top ]
clearpost  [line 1157]

  void clearpost( )



[ Top ]
defaultfield  [line 171]

  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 264]

  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 275]

  void fetch( [boolean $skip_submit = false]  )

Fetch the form output as HTML, and return it.

Parameters:
boolean   $skip_submit: 


[ Top ]
geterrors  [line 812]

  array geterrors( )

Return an array with the fields that have an error.



[ Top ]
getvalues  [line 1093]

  void getvalues( )



[ Top ]
handleUpload  [line 1245]

  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 83]

  void init_html( )

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



[ Top ]
remove  [line 154]

  void remove( string $name  )

Remove a field from the form.

Parameters:
string   $name: 


[ Top ]
renderfield  [line 436]

  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 747]

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

Trigger an error in a field

Parameters:
string   $name: 
string   $error: 


[ Top ]
setvalue  [line 1137]

  void setvalue( $fieldname, $value  )

Parameters:
   $fieldname: 
   $value: 


[ Top ]
setvalues  [line 1118]

  void setvalues( $values  )

Parameters:
   $values: 


[ Top ]
submitlocation  [line 1162]

  void submitlocation( $str  )

Parameters:
   $str: 


[ Top ]
use_javascript  [line 1350]

  void use_javascript( boolean $val  )

Set whether or not to use javascript validation.

Parameters:
boolean   $val: 


[ Top ]
validate  [line 782]

  integer validate( )

Validate the form using the set criteria.



[ Top ]
_fetch_script  [line 334]

  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 1403]

  string _getExtension( string $file  )

Gets the extension (if any) of a filename.

Parameters:
string   $file: 


[ Top ]
_isEmail  [line 1189]

  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 1373]

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

Parameters:
   $str: 
   $strict: 


[ Top ]
_script_criterium  [line 990]

  string _script_criterium( string $criterium  )

Get the values to use in javascript validation.

Parameters:
string   $criterium: 


[ Top ]
_validate_criterium  [line 876]

  boolean _validate_criterium( string $criterium, mixed $value  )

Validate a single criteria in a certain field

Parameters:
string   $criterium: 
mixed   $value: 


[ Top ]
_validate_field  [line 833]

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

Validate a certain field..

Parameters:
string   $key: 
$string   $field: 


[ Top ]

Documentation generated on Tue, 05 Sep 2017 01:06:01 +0200 by phpDocumentor 1.4.3