2017 © Pedro Peláez
 

library html_quickform2

Provides methods to create, validate and render HTML forms in PHP.

image

pear/html_quickform2

Provides methods to create, validate and render HTML forms in PHP.

  • Saturday, June 28, 2014
  • by larakit
  • Repository
  • 18 Watchers
  • 13 Stars
  • 19,731 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 9 Forks
  • 0 Open issues
  • 4 Versions
  • 12 % Grown

The README.md

HTML_QuickForm2

Build Status Static Analysis, (*1)

This is a repository for PEAR HTML_QuickForm2 package that has been migrated from PEAR SVN., (*2)

HTML_QuickForm2 provides methods to create, validate and render HTML forms. It is a PHP5 rewrite of PEAR HTML_QuickForm and related packages., (*3)

Features:, (*4)

  • Supports all form elements defined in HTML4, provides several custom elements. Support for HTML5 form elements is planned.
  • Server-side and client-side validation, several common rules provided. Validation rules can be combined with 'and' and 'or' for complex validation scenarios. Client-side validation can be run on changing the form field and on submitting the form.
  • Client-side validation and Javascript-backed elements use a small self-contained JS library, there is no dependency on JS frameworks.
  • Multipage forms (tabbed forms and wizards) are possible.
  • Pluggable elements, rules, renderers and renderer plugins.

Please report issues via the [PEAR bug tracker] or Github issues., (*5)

Pull requests are welcome., (*6)

Installation

The package may be installed either with PEAR, (*7)

$ pear install HTML_QuickForm2

or with composer, (*8)

$ composer require pear/html_quickform2

Since release 2.1 composer installation relies completely on autoloading and does not contain require_once calls or use include-path option., (*9)

Basic usage

require_once 'HTML/QuickForm2.php'; // Only when installed with PEAR

$form = new HTML_QuickForm2('tutorial');

// Set defaults for the form elements
$form->addDataSource(new HTML_QuickForm2_DataSource_Array([
    'name' => 'Joe User'
]));

// Add some elements to the form
$fieldset = $form->addElement('fieldset')->setLabel('QuickForm2 tutorial example');
$name = $fieldset->addElement('text', 'name', ['size' => 50, 'maxlength' => 255])
                 ->setLabel('Enter your name:');
$fieldset->addElement('submit', null, ['value' => 'Send!']);

// Define filters and validation rules
$name->addFilter('trim');
$name->addRule('required', 'Please enter your name');

// Try to validate a form
if ($form->validate()) {
    echo '

Hello, ' . htmlspecialchars($name->getValue()) . '!

'; exit; } // Output the form echo $form;

Additional examples are in the docs/examples directory., (*10)

Documentation

...is available on PEAR website, (*11)

Generated API documentation for the current release is also there., (*12)

Testing, Packaging and Installing (Pear)

To test, run, (*13)

$ phpunit tests/

after installing dependencies with composer. You can also test the installed package with, (*14)

$ phpunit [PEAR tests dir]/HTML_QuickForm2

Since PEAR package needs its require_once statements re-enabled, please run the helper file before packaging and installing, (*15)

$ php pear-package-helper.php

Then to build, simply, (*16)

$ pear package .pear-package/package.xml

To install from scratch, (*17)

$ pear install .pear-package/package.xml

To upgrade, (*18)

$ pear upgrade -f .pear-package/package.xml

The Versions

28/06 2014

dev-trunk

9999999-dev

Provides methods to create, validate and render HTML forms in PHP.

  Sources   Download

BSD

The Requires

 

The Development Requires

by Alexey Borzov

28/06 2014

v2.0.2

2.0.2.0

Provides methods to create, validate and render HTML forms in PHP.

  Sources   Download

BSD

The Requires

 

The Development Requires

by Alexey Borzov

24/06 2014

v2.0.1

2.0.1.0

Provides methods to create, validate and render HTML forms in PHP.

  Sources   Download

BSD

The Requires

 

The Development Requires

by Alexey Borzov

18/02 2014

dev-topics/composer-for-pear

dev-topics/composer-for-pear

Provides methods to create, validate and render HTML forms in PHP.

  Sources   Download

BSD

The Requires

 

The Development Requires

by Alexey Borzov