Home
Accueil
Downloads
Téléchargements
Forums
Forums
Your Account
Votre compte
Menu
· Accueil ·

· Communication ·
  · Forums
  · Messages privés
  · Contactez nous
  · Recommendez nous
  · Sondages
  · Les projets

· Nouvelles ·Stats
  · Sujets
  · Ecrire un article
  · Articles archivés
  · Articles RSS
  · Lettre de sécurité
  · Archive de lettres

· Téléchargements ·
  · Accueil
  · Nouveautés
  · Mises à jour
  · Thêmes

· Outils ·
  · Outils divers
  · Convertisseur de temps
  · Table de caractères
  · Générateur de boutons
  · Compresseur Javascript

· Documentation ·
  · Wiki
  · Questions/Réponses
  · Documents
  · Manuel PHP-Nuke
  · Manuel PHP
  · Manuel PEAR
  · Encyclopédies

· Liens ·
  · Nos liens
  · Nos fluxs RSS
  · Partenaires
  · Votre publicité
  · Sitemap
  · Mes bannières

· Infos ·
  · Rechercher
  · Votre compte
  · Liste des membres
  · Carte des membres
  · Top

· Divers ·
  · Météo
  · Galeries
  · Statistiques Phpnuke
  · MS Analysis


HTML_QuickForm

HTML_QuickForm

Le package PEAR::HTML_QuickForm fournit des méthodes pour créer, valider et traiter des formulaires HTML.

Introduction

Table des matières
QuickStart -- A tutorial for HTML_QuickForm
QuickHelp -- Answers to most Frequently Asked Questions
QuickForm element types -- What elements can be added to QuickForm
Migration to version 3.2 -- API changes to observe

QuickForm est une bibliothèque pour gérer les formulaires HTML. Cela fournit une validation Javascript, ainsi qu'une autre côté serveur et est personnalisable et extensible de beaucoup de façons. QuickForm est composé de nombreux fichiers. Le fichier principale est QuickForm.php et devrait être installé dans votre dossier pear/HTML. Les autres fichiers importants sont element.php, qui manipule toutes les méthodes concernant les éléments du formulaire, et group.php, qui gère les méthodes permettant de créer des groupes d'éléments dans le formulaire. Les deux se situent dans le répertoire HTML/QuickForm ainsi que les autres objets du formulaire. input.php contient un classe commune pour tous les éléments de type input (text, password...). QuickForm a des objets pour les éléments communs aux formulaires: select, text, password, checkbox, file, submit, reset, button, image, radio, hidden, textarea. QuickForm fournit la possibilité de créer vos propres éléements tant que vous respectez la compatibilité avec l'API commune.

Créer un formulaire simple

Table des matières
constructor HTML_QuickForm::HTML_QuickForm() -- Class constructor
HTML_QuickForm::addElement() -- Adds an element into the form
HTML_QuickForm::apiVersion() -- Returns the current API version
HTML_QuickForm::createElement() -- Creates a new form element of the given type
HTML_QuickForm::elementExists() -- Checks if element is in the form
HTML_QuickForm::errorMessage() -- Returns an error message for error code
HTML_QuickForm::getElementType() -- Returns the type of an element
HTML_QuickForm::getElement() -- Returns a reference to the element
HTML_QuickForm::getMaxFileSize() -- Returns the value of MAX_FILE_SIZE hidden element
HTML_QuickForm::getRegisteredTypes() -- Returns registered element types
HTML_QuickForm::insertElementBefore() -- Inserts a new element right before the other element
HTML_QuickForm::isError() -- Tells whether a result is an error
HTML_QuickForm::isTypeRegistered() -- Checks whether the form element type is supported
HTML_QuickForm::registerElementType() -- Registers a new element type
HTML_QuickForm::removeElement() -- Removes an element
HTML_QuickForm::setMaxFileSize() -- Sets the value of MAX_FILE_SIZE hidden element
HTML_QuickForm::updateElementAttr() -- Updates Attributes for one or more elements

A écrire.

Classes représentants des éléments de formulaires

A écrire

Classes de base

Table des matières
Class Summary HTML_QuickForm_element -- Base class for form elements
constructor HTML_QuickForm_element() -- Class constructor
HTML_QuickForm_element::accept() -- Accepts a renderer
HTML_QuickForm_element::apiVersion() -- Returns the current API version
HTML_QuickForm_element::exportValue() -- Returns a 'safe' element's value (lié au développeur du module)
HTML_QuickForm_element::freeze() -- Freezes the element
HTML_QuickForm_element::getFrozenHtml() -- Returns the value of field without HTML tags
HTML_QuickForm_element::getLabel() -- Returns the label for the element
HTML_QuickForm_element::getName() -- Returns the element name
HTML_QuickForm_element::getType() -- Returns the element type
HTML_QuickForm_element::getValue() -- Returns the value of the form element
HTML_QuickForm_element::isFrozen() -- Returns whether or not the element is frozen
HTML_QuickForm_element::onQuickFormEvent() -- Called by HTML_QuickForm whenever form event is made on this element (lié au développeur du module)
HTML_QuickForm_element::setLabel() -- Sets a label for the element
HTML_QuickForm_element::setName() -- Sets the input field name
HTML_QuickForm_element::setPersistantFreeze() -- Sets whether element value should persist on freeze()
HTML_QuickForm_element::setValue() -- Sets the value of the form element
HTML_QuickForm_element::unfreeze() -- Unfreezes the element
Class Summary HTML_QuickForm_input -- Base class for input form elements
constructor HTML_QuickForm_input() -- Class constructor
HTML_QuickForm_input::setType() -- Sets the element type

Eléments HTML standards

Table des matières
Class Summary HTML_QuickForm_button -- HTML class for a button type element
constructor HTML_QuickForm_button() -- Class constructor
Class Summary HTML_QuickForm_checkbox -- HTML class for a checkbox type field
constructor HTML_QuickForm_checkbox() -- Class constructor
HTML_QuickForm_checkbox::getChecked() -- Returns whether a checkbox is checked
HTML_QuickForm_checkbox::getText() -- Returns the checkbox text
HTML_QuickForm_checkbox::setChecked() -- Sets whether a checkbox is checked
HTML_QuickForm_checkbox::setText() -- Sets the checkbox text
Class Summary HTML_QuickForm_file -- HTML class for a file type element
constructor HTML_QuickForm_file() -- Class constructor
HTML_QuickForm_file::getSize() -- Returns size of file element
HTML_QuickForm_file::getValue() -- Returns information about the uploaded file
HTML_QuickForm_file::isUploadedFile() -- Checks if the element contains an uploaded file
HTML_QuickForm_file::moveUploadedFile() -- Moves an uploaded file into the destination
HTML_QuickForm_file::setSize() -- Sets size of file element
Class Summary HTML_QuickForm_hidden -- HTML class for a hidden type element
constructor HTML_QuickForm_hidden() -- Class constructor
Class Summary HTML_QuickForm_image -- HTML class for a image type element
constructor HTML_QuickForm_image() -- Class constructor
HTML_QuickForm_image::setAlign() -- Sets alignment for image element
HTML_QuickForm_image::setBorder() -- Sets border size for image element
HTML_QuickForm_image::setSource() -- Sets source for image element
Class Summary HTML_QuickForm_password -- HTML class for a password type field
constructor HTML_QuickForm_password() -- Class constructor
HTML_QuickForm_password::setMaxlength() -- Sets maxlength of password element
HTML_QuickForm_password::setSize() -- Sets size of password element
Class Summary HTML_QuickForm_radio -- HTML class for a radio type element
constructor HTML_QuickForm_radio() -- Class constructor
HTML_QuickForm_radio::getChecked() -- Returns whether radio button is checked
HTML_QuickForm_radio::getText() -- Returns the radio text
HTML_QuickForm_radio::setChecked() -- Sets whether radio button is checked
HTML_QuickForm_radio::setText() -- Sets the radio text
Class Summary HTML_QuickForm_reset -- HTML class for a reset type element
constructor HTML_QuickForm_reset() -- Class constructor
Class Summary HTML_QuickForm_select -- Class to dynamically create an HTML SELECT
constructor HTML_QuickForm_select() -- Class constructor
HTML_QuickForm_select::addOption() -- Adds a new OPTION to the SELECT
HTML_QuickForm_select::getMultiple() -- Returns the select mutiple attribute
HTML_QuickForm_select::getPrivateName() -- Returns the element name (possibly with brackets appended)
HTML_QuickForm_select::getSelected() -- Returns an array of the selected values
HTML_QuickForm_select::getSize() -- Returns the select field size
HTML_QuickForm_select::load() -- Loads options from different types of data sources
HTML_QuickForm_select::loadArray() -- Loads the options from an associative array
HTML_QuickForm_select::loadDbResult() -- Loads the options from DB_result object
HTML_QuickForm_select::loadQuery() -- Queries a database and loads the options from the results
HTML_QuickForm_select::setMultiple() -- Sets the select mutiple attribute
HTML_QuickForm_select::setSelected() -- Sets the default values of the select box
HTML_QuickForm_select::setSize() -- Sets the select field size, only applies to 'multiple' selects
Class Summary HTML_QuickForm_submit -- HTML class for a submit type element
constructor HTML_QuickForm_submit() -- Class constructor
Class Summary HTML_QuickForm_text -- HTML class for a text field
constructor HTML_QuickForm_text -- Class constructor
HTML_QuickForm_text::setMaxlength() -- Sets maxlength of text field
HTML_QuickForm_text::setSize() -- Sets size of text field
Class Summary HTML_QuickForm_textarea -- HTML class for a textarea type field
constructor HTML_QuickForm_textarea() -- Class constructor
HTML_QuickForm_textarea::setCols() -- Sets width in cols for textarea element
HTML_QuickForm_textarea::setRows() -- Sets height in rows for textarea element
HTML_QuickForm_textarea::setWrap() -- Sets wrap type for textarea element
Class Summary HTML_QuickForm_xbutton -- Class for HTML 4.0 <button> element
constructor HTML_QuickForm_xbutton() -- Class constructor
HTML_QuickForm_xbutton::setContent() -- Sets the contents of the element

Eléments personalisables

Table des matières
Class Summary HTML_QuickForm_advcheckbox -- HTML class for an advanced checkbox type field
constructor HTML_QuickForm_advcheckbox() -- Class constructor
HTML_QuickForm_advcheckbox::getOnclickJs() -- Create the javascript for the onclick event
HTML_QuickForm_advcheckbox::getPrivateName() -- Gets the private name for the element
HTML_QuickForm_advcheckbox::setValues() -- Sets the values used by the hidden element
Class Summary HTML_QuickForm_autocomplete -- HTML class for a text field with autocompletion feature
constructor HTML_QuickForm_autocomplete -- Class constructor
HTML_QuickForm_autocomplete::setoptions() -- Sets the options for the autocomplete input text element
Class Summary HTML_QuickForm_date -- Class for a group of elements used to input dates (and times).
constructor HTML_QuickForm_date() -- Class constructor
Class Summary HTML_QuickForm_header -- A pseudo-element used for adding headers to form
constructor HTML_QuickForm_header() -- Class constructor
Class Summary HTML_QuickForm_hiddenselect -- Creates hidden elements with select's values
constructor HTML_QuickForm_hiddenselect() -- Class constructor
Class Summary HTML_QuickForm_hierselect -- Class to dynamically create chained HTML Select elements, each select changes the content of the next.
constructor HTML_QuickForm_hierselect() -- Class constructor
HTML_QuickForm_hierselect::setOptions() -- Sets the options for the select elements
HTML_QuickForm_hierselect::setMainOptions() -- DEPRECATED: Sets the options for the first select
HTML_QuickForm_hierselect::setSecOptions() -- DEPRECATED: Sets the options for the secondary select
Class Summary HTML_QuickForm_html -- A pseudo-element used for adding raw HTML to form (deprecated)
constructor HTML_QuickForm_html() -- Class constructor
Class Summary HTML_QuickForm_link -- HTML class for a link type field
constructor HTML_QuickForm_link() -- Class constructor
HTML_QuickForm_link::setHref() -- Sets the links href
Class Summary HTML_QuickForm_static -- HTML class for static data
constructor HTML_QuickForm_static() -- Class constructor
HTML_QuickForm_static::setText() -- Sets the text

Utiliser les groupes

Table des matières
HTML_QuickForm::addGroup() -- Adds an element group
Class Summary HTML_QuickForm_group -- HTML class for a form element group
constructor HTML_QuickForm_group() -- Class constructor
HTML_QuickForm_group::getElementName() -- Returns the name of an element inside the group
HTML_QuickForm_group::getElements() -- Gets the grouped elements
HTML_QuickForm_group::getGroupType() -- Gets the group type based on its elements.
HTML_QuickForm_group::setElements() -- Sets the grouped elements

A écrire.

Travailler avec les valeurs des éléments

Cette section couvre les méthodes offertes par QuickForm pour gérer les valeurs des éléments des formulaires et travailler avec les valeurs soumises.

Getting, setting and processing element values

Table des matières
HTML_QuickForm::setConstants() -- Sets constant form values
HTML_QuickForm::setDefaults() -- Sets default form values
HTML_QuickForm::exportValue() -- Returns the element's "safe" value
HTML_QuickForm::exportValues() -- Returns "safe" elements' values
HTML_QuickForm::getElementValue() -- Returns the element's raw value
HTML_QuickForm::getSubmitValue() -- Returns the submitted element's value
HTML_QuickForm::getSubmitValues() -- Returns the values submitted by the form
HTML_QuickForm::process() -- Performs the form data processing

Validation and filtres

Table des matières
Introduction - validation and filters -- How to process submitted data
HTML_QuickForm::addRule() -- Adds a validation rule for the given field
HTML_QuickForm::addGroupRule() -- Adds a validation rule for the given group
HTML_QuickForm::addFormRule() -- Adds a global validation rule
HTML_QuickForm::isElementRequired() -- Returns whether the form element is required
HTML_QuickForm::validate() -- Performs the server side validation
HTML_QuickForm::getElementError() -- Returns error corresponding to validated element
HTML_QuickForm::setElementError() -- Set error message for a form element
HTML_QuickForm::registerRule() -- Registers a new validation rule
HTML_QuickForm::getRegisteredRules() -- Returns registered validation rules
HTML_QuickForm::isRuleRegistered() -- Returns whether the rule is supported
HTML_QuickForm::applyFilter() -- Applies a filter for the given field(s)

QuickForm fournit également des règles pour le support de la validation. Vous pouvez programmer vos propres règles de validation, les enregister dans QuickForm et ensuite les appeler dans votre script. Par défaut, QuickForm peut manipuler les expressions rationnelles (du type d'preg_match) et vérifier les éléments requis. Si vous souhaitez une validation du côté client, QuickForm peut générer le code Javascript requis. La validation côté serveur est toujours activée par défaut.

QuickForm peut égalment utiliser des filtres pour importer des données dans le formulaire ou pour traiter les données une fois que le formulaire a été envoyé. Les filtres fonctionnent de la même façon que les filtres à part que l'on a pas besoin de les enregistrer. Vous pouvez écrire vos propres fonctions filtres ou les appeler dans votre script. Vous pouvez appeler n'importe quelle fonction php (par ex. trim, addslashes, htmlentities, etc.) et les appliquer de façon récursive à la valeur de vos éléments.

Outputting the form

Votre formulaire peut être personnalisé de nombreuses façons. QuickForm peut utiliser différents types de moteurs de rendu et en fourni un par défaut qui support la personnalisation du formulaire, des éléments, des messages d'erreur, des en-têtes, des notes et signes des éléments requis. Vous pouvez également écrires vos propres moteurs de rendu.

Form customization and output helpers

Table des matières
HTML_QuickForm::freeze() -- "Freezes" the form's elements
HTML_QuickForm::isElementFrozen() -- Checks whether the element is frozen
HTML_QuickForm::isFrozen() -- Checks whether the form is frozen
HTML_QuickForm::setRequiredNote() -- Sets required note
HTML_QuickForm::setJsWarnings() -- Sets JavaScript warning messages
HTML_QuickForm::getRequiredNote() -- Returns the required note
HTML_QuickForm::getValidationScript() -- Returns the client side validation script
HTML_QuickForm::accept() -- Accepts a renderer
HTML_QuickForm::defaultRenderer() -- Returns a reference to default renderer object
HTML_QuickForm::toArray() -- Returns the form's contents in an array
HTML_QuickForm::toHtml() -- Returns an HTML version of the form
HTML_QuickForm::display() -- Outputs an HTML version of the form

Moteurs de rendu simples

Ces moteurs sont fondé sur le code de HTML_QuickForm pre-3.0 et ne nécessite aucune classe externe pour fonctionner.

Moteurs de rendu fondé sur les templates

Table des matières
HTML_QuickForm_Renderer_ArraySmarty -- A renderer for 'static' Smarty templates
constructor HTML_QuickForm_Renderer_ArraySmarty::HTML_QuickForm_Renderer_ArraySmarty() -- Constructor
HTML_QuickForm_Renderer_ArraySmarty::setErrorTemplate() -- Sets the way elements with validation errors are rendered
HTML_QuickForm_Renderer_ArraySmarty::setRequiredTemplate() -- Sets the way required elements are rendered
HTML_QuickForm_Renderer_ITDynamic -- Dynamic renderer for Integrated Templates
constructor HTML_QuickForm_Renderer_ITDynamic::HTML_QuickForm_Renderer_ITDynamic() -- Constructor
HTML_QuickForm_Renderer_ITDynamic::setElementBlock() -- Sets the block to use for element rendering
HTML_QuickForm_Renderer_ITDynamic::setHeaderBlock() -- Sets the name of a block to use for header rendering
HTML_QuickForm_Renderer_ITStatic -- Static renderer for Integrated Templates
constructor HTML_QuickForm_Renderer_ITStatic::HTML_QuickForm_Renderer_ITStatic() -- Constructor
HTML_QuickForm_Renderer_ITStatic::setErrorTemplate() -- Sets the way elements with validation errors are rendered
HTML_QuickForm_Renderer_ITStatic::setRequiredTemplate() -- Sets the way required elements are rendered
HTML_QuickForm_Renderer_QuickHtml -- Render form elements into HTML in an easy and flexible manner
constructor HTML_QuickForm_Renderer_QuickHtml::HTML_QuickForm_Renderer_QuickHtml() -- Constructor
HTML_QuickForm_Renderer_QuickHtml::toHtml() -- Returns the HTML
HTML_QuickForm_Renderer_QuickHtml::elementToHtml() -- Renders a specific form element into HTML

Ces moteurs de rendu utilisent des gestionnaires de templates pour générer réellement leur formulaire HTML.

Intrastructure du moteur de rendu

Table des matières
HTML_QuickForm_Renderer -- Abstract base class for renderers (lié au développeur du module)
HTML_QuickForm_Renderer::startForm() -- Start visiting a form (lié au développeur du module)
HTML_QuickForm_Renderer::finishForm() -- Finish visiting a form (lié au développeur du module)
HTML_QuickForm_Renderer::startGroup() -- Start visiting a group (lié au développeur du module)
HTML_QuickForm_Renderer::finishGroup() -- Finish visiting a group (lié au développeur du module)
HTML_QuickForm_Renderer::renderElement() -- Visit an element (lié au développeur du module)
HTML_QuickForm_Renderer::renderHeader() -- Visit a header (lié au développeur du module)
HTML_QuickForm_Renderer::renderHidden() -- Visit a hidden element (lié au développeur du module)
HTML_QuickForm_Renderer::renderHtml() -- Visit a raw HTML/text element (lié au développeur du module)

Si vous voulez modifier un moteur de rendu existant ou en écrire un nouveau, cette section vous concerne.


Manuel PEAR pour PHP-Nuke © www.stefvar.com
Syndiquez notre contenu RSS, Atom, etc..
PHP-Nuke © 2007Reproduction interdite sans autorisation de ma part www.stefvar.com Copyright © 2008Thème iCGstation
Site français de la communauté PragmaMx