Dokeos
[ class tree: Dokeos ] [ index: Dokeos ] [ all elements ]

Class: FormValidator

Source Location: /main/inc/lib/formvalidator/FormValidator.class.php

Class Overview

HTML_QuickForm
   |
   --FormValidator

Objects of this class can be used to create/manipulate/validate user input.


Methods



Class Details

[line 39]
Objects of this class can be used to create/manipulate/validate user input.



[ Top ]


Class Methods


constructor FormValidator [line 51]

FormValidator FormValidator( string $form_name, [string $method = 'post'], [string $action = ''], [string $target = ''], [mixed $attributes = null], [bool $trackSubmit = true])

Constructor



Parameters:

string   $form_name   Name of the form
string   $method   Method ('post' (default) or 'get')
string   $action   Action (default is $PHP_SELF)
string   $target   Form's target defaults to '_self'
mixed   $attributes   (optional)Extra attributes for <form> tag
bool   $trackSubmit   (optional)Whether to track if the form was submitted by adding a special hidden field (default = true)

[ Top ]

method add_datepicker [line 168]

void add_datepicker( string $name, string $label)

Add a datepicker element to the form

A rule is added to check if the date is a valid one




Parameters:

string   $label   The label for the form-element
string   $name   The element name

[ Top ]

method add_html_editor [line 133]

void add_html_editor( string $name, string $label, [boolean $required = true], [ $full_page = false])

Add a HTML-editor to the form to fill in a title.

A trim-filter is attached to the field. A HTML-filter is attached to the field (cleans HTML) A rule is attached to check for unwanted HTML




Parameters:

string   $label   The label for the form-element
string   $name   The element name
boolean   $required   Is the form-element required (default=true)
   $full_page  

[ Top ]

method add_multiple_required_rule [line 292]

void add_multiple_required_rule( $elements, string $message, array $element)

This function avoid to change directly QuickForm class.

When we use it, the element is threated as 'required' to be dealt during validation




Parameters:

array   $element   the array of elements
string   $message   the message displayed
   $elements  

[ Top ]

method add_progress_bar [line 206]

void add_progress_bar( [int $delay = 2], [ $label = ''])

Adds a progress bar to the form.

Once the user submits the form, a progress bar (animated gif) is displayed. The progress bar will disappear once the page has been reloaded.




Parameters:

int   $delay   The number of seconds between the moment the user submits the form and the start of the progress bar.
   $label  

[ Top ]

method add_real_progress_bar [line 226]

void add_real_progress_bar( upload_id $upload_id, elementAfter $elementAfter, [delay $delay = 2], [waitAfterUpload $waitAfterUpload = false])

Use the new functions (php 5.2) allowing to display a real upload progress.



Parameters:

upload_id   $upload_id   the value of the field UPLOAD_IDENTIFIER
elementAfter   $elementAfter   the first element of the form (to place at first UPLOAD_IDENTIFIER
delay   $delay   the frequency of the xajax call
waitAfterUpload   $waitAfterUpload  

[ Top ]

method add_resource_button [line 190]

void add_resource_button( )

Add a button to the form to add resources.



[ Top ]

method add_textfield [line 114]

void add_textfield( string $name, string $label, [boolean $required = true], [array $attributes = array()])

Add a textfield to the form.

A trim-filter is attached to the field.




Parameters:

string   $label   The label for the form-element
string   $name   The element name
boolean   $required   Is the form-element required (default=true)
array   $attributes   Optional list of attributes for the form-element

[ Top ]

method add_timewindow [line 181]

void add_timewindow( $name_1, $name_2, $label_1, $label_2, string $label, string $name)

Add a timewindow element to the form.

2 datepicker elements are added and a rule to check if the first date is before the second one.




Parameters:

string   $label   The label for the form-element
string   $name   The element name
   $name_1  
   $name_2  
   $label_1  
   $label_2  

[ Top ]

method display [line 303]

void display( )

Display the form.

If an element in the form didn't validate, an error message is showed asking the user to complete the form.




[ Top ]

method return_form [line 317]

string return_form( )

Returns the HTML code of the form.

If an element in the form didn't validate, an error message is showed asking the user to complete the form.




Tags:

return:  HTML code of the form
author:  Patrick Cool <patrick.cool@UGent.be>, Ghent University
version:  Dokeos 1.8, august 2006


[ Top ]


Documentation generated on Wed, 05 Sep 2007 06:14:42 +0200 by phpDocumentor 1.4.0