2017 © Pedro PelĂĄez
 

library zebra_form

A jQuery augmented PHP library for creating and validating HTML forms

image

stefangabos/zebra_form

A jQuery augmented PHP library for creating and validating HTML forms

  • Thursday, August 17, 2017
  • by stefangabos
  • Repository
  • 25 Watchers
  • 94 Stars
  • 706 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 47 Forks
  • 16 Open issues
  • 6 Versions
  • 2 % Grown

The README.md

Zebra_Form

A jQuery augmented PHP library for creating and validating HTML forms


Packagist stats, (*1)

Latest Stable Version Total Downloads Monthly Downloads Daily Downloads License, (*2)

Zebra_Form is a PHP library that greatly simplifies the process of creating and validating HTML forms. Its object-oriented structure promotes rapid HTML forms development and encourages developers to write clean and easily maintainable code and it frees the developers from the repetitive task of writing the code for validating forms by offering powerful built-in client-side and server-side validation., (*3)

Zebra_Form has integrated cross-site scripting (XSS) prevention mechanism that automatically strips out potentially malicious code from the submitted data, and also features protection against cross-site request forgery (CSRF) attacks. It also prevents automated SPAM posts, out of the box and without relying on CAPTCHA by using honeypots., (*4)

Forms layout can be generated either automatically or manually – using templates. When generated automatically, the generated output validates as HTML 4.01 Strict, XHTML 1.0 Strict or HTML5, and has the same look & feel across all major browsers like Firefox, Chrome, Opera, Safari and Internet Explorer 6+., (*5)

It provides all the controls you’d expect in an HTML form and, additionally, date/time pickers, CAPTCHA and advanced AJAX-like file upload controls – see the documentation for validation rules that can be used out of the box., (*6)

The client-side validation is done using jQuery 1.5.2+, (*7)

Zebra_Form's code is heavily commented and generates no warnings/errors/notices when PHP’s error reporting level is set to E_ALL., (*8)

Features

  • provides protection against cross-site scripting (XSS) and cross-site request forgery (CSRF) attacks out of the box it automatically prevents automated SPAM posts using the “honeypot” technique (CAPTCHAs can also be used for even stronger protection)
  • provides both server-side and client-side validation (client-side validation is done using jQuery 1.5.2+) and has a lot of predefined rules that can be used out of the box; custom validation rules (including AJAX-based) can easily be added
  • forms’ layout can be generated either automatically or manually using templates
  • generated output validates as HTML 4.01 Strict, XHTML 1.0 Strict or HTML5
  • works in all major browsers like Firefox, Chrome, Opera, Safari and Internet Explorer 6+
  • code is heavily commented and generates no warnings/errors/notices when PHP’s error reporting level is set to E_ALL
  • has comprehensive documentation

Requirements

PHP 5.0.2+ (preferably PHP 5.3.0 compiled with the “fileinfo” extension for more secure file uploads – read more at the change log for version 2.7.3), (*9)

jQuery 1.5.2+, (*10)

How to use

The HTML

<!DOCTYPE html>

<html>

    <head>

        <title>Zebra_Form Example</title>

        <meta charset="utf-8">

        <!-- load Zebra_Form's stylesheet file -->
        <link rel="stylesheet" href="path/to/zebra_form.css">

    </head>

    <body>

        <!-- the PHP code below goes here -->

        <!-- load jQuery -->
        <script src="path/to/jquery.js"></script>

        <!-- load Zebra_Form's JavaScript file -->
        <script src="path/to/zebra_form.js"></script>

    </body>

</html>
The PHP
// include the Zebra_Form class
require 'path/to/Zebra_Form.php';

// instantiate a Zebra_Form object
$form = new Zebra_Form('form');

// the label for the "email" field
$form->add('label', 'label_email', 'email', 'Email');

// add the "email" field
$obj = $form->add('text', 'email', '', array('autocomplete' => 'off'));

// set rules
$obj->set_rule(array(

    // error messages will be sent to a variable called "error", usable in custom templates
    'required'  =>  array('error', 'Email is required!'),
    'email'     =>  array('error', 'Email address seems to be invalid!'),

));

// "password"
$form->add('label', 'label_password', 'password', 'Password');

$obj = $form->add('password', 'password', '', array('autocomplete' => 'off'));

$obj->set_rule(array(

    'required'  => array('error', 'Password is required!'),
    'length'    => array(6, 10, 'error', 'The password must have between 6 and 10 characters'),

));

// "remember me"
$form->add('checkbox', 'remember_me', 'yes');

$form->add('label', 'label_remember_me_yes', 'remember_me_yes', 'Remember me');

// "submit"
$form->add('submit', 'btnsubmit', 'Submit');

// validate the form
if ($form->validate()) {

    // do stuff here

}

// auto generate output, labels above form elements
$form->render();

For demos and more information visit the project's homepage, (*11)

The Versions

17/08 2017

dev-master

9999999-dev http://stefangabos.ro/php-libraries/zebra-form/

A jQuery augmented PHP library for creating and validating HTML forms

  Sources   Download

LGPL-3.0

The Requires

  • php >=5.3.0

 

form validation validate xss csrf jquery validation honeypot client side validation server side validation

10/09 2016

dev-templates

dev-templates http://stefangabos.ro/php-libraries/zebra-form/

A jQuery augmented PHP library for creating and validating HTML forms

  Sources   Download

LGPL-3.0

The Requires

  • php >=5.3.0

 

form validation validate xss csrf jquery validation honeypot client side validation server side validation

18/05 2016

2.9.8

2.9.8.0 http://stefangabos.ro/php-libraries/zebra-form/

A jQuery augmented PHP library for creating and validating HTML forms

  Sources   Download

LGPL-3.0

The Requires

  • php >=5.3.0

 

form validation validate xss csrf jquery validation honeypot client side validation server side validation

14/01 2016

2.9.7

2.9.7.0 http://stefangabos.ro/php-libraries/zebra-form/

A jQuery augmented PHP library for creating and validating HTML forms

  Sources   Download

LGPL-3.0

The Requires

  • php >=5.0.2

 

form validation validate xss csrf jquery validation honeypot client side validation server side validation

05/01 2016

2.9.6

2.9.6.0 http://stefangabos.ro/php-libraries/zebra-form/

A jQuery augmented PHP library for creating and validating HTML forms

  Sources   Download

LGPL-3.0

The Requires

  • php >=5.0.2

 

form validation validate xss csrf jquery validation honeypot client side validation server side validation

04/11 2014

2.9.5

2.9.5.0 http://stefangabos.ro/php-libraries/zebra-form/

A jQuery augmented PHP library for creating and validating HTML forms

  Sources   Download

LGPL-3.0

The Requires

  • php >=5.0.2

 

form validation validate xss csrf jquery validation honeypot client side validation server side validation