Stefan Gabos web developer extraordinaire
Zebra_Form, a jQuery augmented PHP library for creating and validating HTML forms
-
Latest version2.9.2released onApril 18, 2013
- 1. Overview
- 2. Features
- 3. Requirements
- 4. Installation
- 5. How to use
- 6. Download
- 7. Documentation
- 8. Changelog
- 9. Comments
Zebra_Form is a PHP library that 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. 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.
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.
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+.
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.
The client-side validation is done using jQuery 1.5.2+
Zebra_Form‘s code is heavily commented and generates no warnings/errors/notices when PHP’s error reporting level is set to E_ALL.
Features review
- 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)
jQuery 1.5.2+
Installation
Download the latest version, unpack it, and put it in a place accessible to your scripts.
How to use
The HTML
<!-- must be in strict mode! -->
<!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">
<!-- load jQuery -->
<script src="path/to/jquery.js"></script>
<!-- load Zebra_Form's JavaScript file -->
<script src="path/to/zebra_form.js"></script>
</head>
<body>
<!-- the PHP code below goes here -->
</body>
</html>
The PHP
<?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();
?>
Download
Zebra_Form is distributed under the LGPL.
In plain English, this means that you have the right to view and to modify the source code of this software, but if you modify and distribute it, you are required to license your copy under a LGPL-compatible license, and to make the entire source code of your derivation available to anybody you distribute the software to.
You also have the right to use this software together with software thas has different licensing terms (including, but not limited to, commercial and closed-source software), and distribute the combined software, as long as state that your software contains portions licensed under the LGPL license, and provide information about where the LGPL licensed software can be downloaded.
If you distribute copies of this software you may not change the copyright or license of this software.
You may also like:
- Zebra_cURL, a a high performance PHP cURL library
- Zebra_Database, a MySQL database wrapper written in PHP
- Zebra_Form, a jQuery augmented PHP library for creating and validating forms
- Zebra_Image, a lightweight image manipulation library written in PHP
- Zebra_Mptt, a PHP implementation of the modified preorder tree traversal algorithm
- Zebra_Pagination, a generic pagination class written in PHP
- Zebra_Session, a wrapper for PHP's default session handling functions, using MySQL for storage
Documentation
|
Become a ninja. Read the comprehensive documentation. |
Changelog
Click on a version to expand/collapse information.
- version 2.9.2 (April 18, 2013)
-
- fixed a bug introduced in the previous release that broke functionality in IE8 and below…yes, I forgot a console.log() in the code!
- fixed a bug where the “image” control would not have the “alt” attribute set, and so the resulting HTML could not be validated by the W3C validator;
- fixed a bug where the iFrame used for checking uploaded files client-side was sometimes be visible on IE8 and below;
- changed how the upload path needs to be specified for the “upload” rule, which now needs to be a full web path (so not server path nor a relative path) and “process.php” and the “_upload” method in Zebra_Form.php will automatically determine the correct server path to where to upload the files to; hopefully this will solve the problems people were having; still, being behind a reverse-proxy will require manual adjustment of the logic used both in “process.php” and in the “_upload” method in “Zebra_Form.php”;
- the “dependencies” rule now also supports “submit” buttons/images; see the example for a scenario where it makes sense;
- removed the * (all) selector from CSS and now custom elements placed in both custom and auto-generated templates don’t suffer from it;
- the “attach_tip” JavaScript method can now be used on any element, not just on those that already have rules attached;
- clientside_validation method has a new “on_ready” property used for specifying a JavaScript function to be executed when the form is ready; useful for getting a reference to Zebra_Form object *after* it’s ready – see the documentation for an example;
- updated Spanish language file; thanks WaKeMaTTa;
- version 2.9.1 (March 10, 2013)
-
- dropped support for PHP4; minimum required version is now PHP 5.0.2;
- fixed some compatibility issues affecting the “dependencies” rule when used with radio buttons and jQuery 1.9.0+;
- added support for date picker’s “always_show_clear” and “always_visible” properties; thanks to Sebastian Popa;
- fixed a bug where the script would sometimes fail to determine the correct path for file uploads; thanks to John Prentice;
- fixed a bug where dates having random extra white-space in them would pass validation; thanks to Arne Tarara;
- fixed a bug where setting the “require_protocol” argument of the “url” rule to TRUE, had no effect client-side; thanks Stefan;
- fixed an error in the documentation; thanks Stefan;
- fixed a small bug where when specifying custom attributes for an element as a string rather than an array, would trigger a PHP warning; thanks Søren;
- fixed a small issue with the file uploads where the content of the iFrame used for the client-side validation was destroyed before being fully loaded, resulting in a “Canceled” status rather than a 200 (OK); this was not affecting functionality;
- version 2.9.0a (February 13, 2013)
-
- fixed a bug where disabling weekdays resulted in date to never pass validation;
- version 2.9.0 (February 10, 2013)
-
- fixed a few depencies related bugs; thanks to Arne Tarara
- fixed an issue that broke the library’s functionality when using jQuery 1.9.0 (which removed $.browser);
- fixed a bug where date format not including days or month (like only ‘Y’ or ‘M, Y’, etc) would never pass validation; thanks to Hicham;
- fixed a bug where the “Clear” button on the date picker was not using the string from the language file; thanks Nicola Tuveri;
- fixed an issue where the library would break with plugins that hide the original elements and put in their places divs having the exact same classes as the original element; thanks to Daniele Picca
- fixed a bug where the “length” rule was not taken into consideration when using “auto_fill” for elements having also the “digits” and/or “number” rule set;
- fixed a bug where if the “length” rule had a fourth argument (the show_counter argumet), the error message would be empty;
- fixed a bug where a text longer than set by the “length” rule could be set as default for an element;
- fixed a bug in “process.php” which broke CAPTCHA images in PHP 5.4.0+ because the second argument to the “imagejpeg” function was an empty string instead of “null”; thanks to Thomas;
- fixed an issue where elements having an empty string as name could be created;
- fixed an issue where the library would sometimes generate “strict warnings” for PHP 5.3.0+;
- custom attributes (like class names or other attributes) can now be specified when creating bulk radio buttons and checkboxes by adding a 4th argument; see the last example in each of the two links;
- added Italian language file; thanks Nicola Tuveri;
- updated German and French language files; thanks Andreas Schwarz;
- some updates and corrections in the documentation; thanks to Hicham, Søren and Oliver Jones;
- updated Zebra_DatePicker to version 1.6.7;
- version 2.8.9e (January 17, 2013)
-
- fixed a bug where dependencies were working only if the proxy element was a radio button or a checkbox; set thanks to Hicham;
- version 2.8.9d (January 15, 2013)
-
- fixed a bug where setting some of the date control’s properties would break the date picker; thanks to Bastian Flinspach;
- fixed a bug where seting the “length” rule to having “0″ (no limit) as the upper limit, would set the element’s “maxlength” attribute to “0″; thanks to Bastian Flinspach;
- fixed a bug where keypress events on an file upload control were ignored;
- fixed a bug where the “clientside_validation” method was always using the default values if the form contained at least one file upload control; thanks to Antonio Marmolejo;
- fixed a bug where the character count on textareas was not done correctly if the text contained characters that would get transformed into HTML entitite; thanks to Antonio Marmolejo
- fixed some inconsistencies in the documentation;
- updated Zebra_DatePicker to version 1.6.6;
- version 2.8.9c (January 12, 2013)
-
- fixed a bug where custom arguments for the “custom” rule were not passed correctly;
- fixed a bug where dependencies on an element with no other rules would be ignored;
- updated Zebra_DatePicker to version 1.6.5;
- version 2.8.9b (January 10, 2013)
-
- fixed a bug where since the last release the files upload control was not working anymore;
- fixed a bug where the library would trigger a JavaScript error if none of the form’s element would have any validation rule;
- some updates in the documentation
- version 2.8.9 (January 08, 2013)
-
- added a new rule called “dependencies”; using it you can now have conditional validation (elements that are validated only if one or more other controls have certain values); see the example and peek into the documentation;
- for browsers that obey the “accept” attribute for file upload controls (at the time of writing Chrome 16+ and IE 10), the file browser will now only show the files defined by the “filetype” rule or images only if the “image” rule is set;
- added a new method: auto_fill – call this method to instruct the library to automatically fill out all or only selected form’s fields with random content while obeying any rules that might be set for each control – huge time saver for when debugging forms; check out the example;
- added a new method: captcha_storage by which the storage method for CAPTCHA values can be changed from “cookie” to “session”; useful for users who have very restrictive cookie policies;
- uneditable prefixes can now be added to text and password inputs – like “http://” or an area code like “+(40)”, or images and html; check out the examples and the documentation;
- users can now regenerate CAPTCHAS if needed; see the examples;
- previously, server-side, dates where only checked for format but not also for direction and disabled dates so malicious users could manipulate the DOM and enter out-of-range values; now the validity of date values is also enforced server-side;
- fixed a bug where the placeholder, if the element had margins, would not be correctly positioned; thanks to Faton Sopa;
- fixed a bug where having elements with names representing array properties in JavaScript (length, constructor, prototype) would result in error messages not showing for that particular element in client-side validation;
- fixed a bug which I thought it was fixed in 2.8.3 regarding the order in which rules are checked;
- fixed a bug where when having “validate_on_the_fly” for client-side validation and moving away from a date control without selecting a date, would correctly show the error tip with the message, but the error would not automatically go away when selecting date, and the user would manually need to hide the error message;
- fixed a bug in the CSS affecting notes placed after a date control on Internet Explorer 7;
- fixed a bug where when using placeholders for textareas the “resize” icon (on browsers that automatically place it on textareas) would appear twice; thanks to Andrei Bodeanschi
- fixed a bug where having an error message on select control with the “other” option selected, the error message would not automatically disappear once the “other” field was filled out;
- fixed a WebKit-specific issue where Chrome & Safari seem to get it wrong for password fields when using various font families, and display really small dots instead of the discs that appear for every other browser – now WebKit browsers will behave as expected;
- updated Zebra_DatePicker to version 1.6.4;
- version 2.8.8 (November 08, 2012)
-
- fixed a bug where the library would think that an & directly before a character is an HTML entity, and would incorrectly insert a semicolon after the “entity”; thanks to Arne Tarara
- fixed a bug where for PHP versions prior to 5.2.0 the library would trigger an error when trying to set the CSRF cookie; thanks to hector;
- fixed a bug where custom arguments were never actually passed to custom rules; thanks to Andreas;
- fixed a bug where in PHP versions before 5.3 using a hyphen (dash) as among the extra allowed characters in the “alphabet”, “alphanumeric”, “float”, “digits”, “number”, rule would crash the script; thanks to Andreas
- fixed an issue where a hack was needed in order for displaying SPAM or CSRF errors in custom templates; now a new $zf_error variable will be available in custom templates which will display these errors (in the same way as it errors are displayed after server-side validation); see an example in the documentation (the second code block); thanks to Thomas;
- fixed an issue where assigning custom classes to elements upon adding them to the form (through the add() method) would break those elements as the custom class would replace the classes added by the library; the solution was to add custom classes through the set_attributes() method; now adding custom classes directly via the add() method will work as expected; thanks to Wim;
- fixed a bug when reporting some internal errors;
- added a new validation rule: “url” which validates URLs; see the documentation for more information;
- inverted the order of the first two arguments of the csrf() method – if you are using the method, make sure you update the arguments order after updating Zebra_Form!
- minor performance tweaks in the PHP code
- updated Spanish language file; thanks to Delegado 3iti
- updated Zebra_DatePicker to version 1.6.1
- version 2.8.7 (September 15, 2012)
-
- fixed a bug with the file upload control where client-side validation would correctly report an invalid upload path *only* if the “required” rule was also set; now, when uploading a file, the library will check if the upload path exists even if the “required” rule is not set; thanks to Jan;
- fixed a bug where if the form was validated and submitted manually through JavaScript, the library would validate the form twice; also, updated the recommended way of doing manual form validation and submission – see documentaion;
- fixed an issue where no custom HTML attributes (like “style”, for example) could be set for the select boxes generated by the Time control; thanks to Faton Sopa;
- custom date pickers can now also be used; to disable the default date picker you’ll have to call the newly added disable_zebra_datepicker() method available for “date” elements; date format, direction and disabled dates will still apply and will be taken into account when validating the date, but the other properties will be ignored as are specific to Zebra_DatePicker; thanks to Faton Sopa for suggesting;
- better error handling and documentation for when the library is trying to use cookies for storing the CSRF token, but output was already sent to the browser prior to instantiating the library, and output buffering is turned off in php.ini;
- in previous versions, when using “horizontal” templates and, thus, tables, I was using the deprecated “valign” attribute on table cells and so the generated output was not valid HTML5; now it is handled from CSS by using “vertical-align”; thanks to Andreas;
- additions and corrections to the documentation; thanks to Jan for spotting some errors!
- version 2.8.6 (August 13, 2012)
-
- fixed a bug where having the ‘other’ option set for select controls having non-numerical values, would result in the form never passing validation; thanks to Edward;
- fixed a bug where for select boxes having non-numerical indices, a malicious user could submit other values than those defined when creating the form; thanks to Edward;
- fixed a bug with the XSS cleaner, which apeared since the update in 2.8.4; thanks to Dimitri;
- updated Zebra_DatePicker to version 1.4.1
- version 2.8.5 (July 23, 2012)
-
- fixed a bug where file controls were *always* requried even if the “required” rule was not set; thanks Andre
- fixed a few bugs related to the generation of the CSRF token where the token was always generated with the default values and was re-generated each time the csrf() method was called;
- the library will now automatically decide what method to use for storing the CSRF token (session or cookie) in so that if a session is already started it will store the token in session or in a cookie otherwise; thanks to PunKeel for the heads up;
- the “render” method now accepts an optional third argument for bulk variable assignment (representing a quicker method than using the old “assign” method for each variable); thanks to serge.munoz
- version 2.8.4 (July 19, 2012)
-
- added protection against cross-site request forgery (CSRF) attacks; the protection is enabled by default, but offers a lower level of security as it is based on session cookies (cookies that expire when the browser is closed) rather than on PHP sessions – this is intentional so that it doesn’t interfere with your environment in case you don’t use sessions. Therefore, you are encouraged to use PHP sessions and to call the newly added csrf() method and properly configure your protection against CSRF attacks, in order to maximize the level of security of your forms.
- fixed a few bugs related to the date control; thanks Jack Everson
- fixed a bug where setting “validate_all” to true would have no effect; thanks Thomas
- hopefully the bug where sometimes error messages remained stuck and could not be closed anymore, is now fixed;
- placeholders now clone the parent element’s styles (padding, border, font style, font weight, font size)
- previously when “scroll_to_error” was set to TRUE the page would scroll to the element.top – 10px which meant that the element in question was always too close to the top edge of the screen; now the library tries to scroll so that the element is vertically centered in the view port
- updated the part of the library taking care of cross site scripting (XSS) prevention as per the latest developments in CodeIgniter (as that particular piece of code is taken from the CodeIgniter PHP framework)
- all error messages now correctly report the file name and the line that caused the error; PHP’s trigger_error() shows the file and the line number where the function is called and we would always trigger the errors from one of the Zebra_Form’s file when the errors actually generate from user files;
- hidden fields used by the library internally were previously available in the $_POST superglobal after submission and now are automatically stripped out so that we don’t pollute the $_POST;
- the minimum required PHP version is now 4.3 instead of 4.2
- there are some additions to the language files and if you speak one of the languages there i’d be thankful if you could provide some translations. thank you!
- version 2.8.3 (July 08, 2012)
-
- fixed a bug where using the “digits” rule in a form having – (dashes) in its name would crash the script;
- fixed a bug where previously *all* the rules were checked in the order defined when creating the form, potentially leading to nonsense situations like having the “filetype” or “filesize” rules before the “upload” rule, or any other rule before the “required” rule; now, the “required” rule is *always* checked first, and the “upload” rule is *always* checked first if there is no “required” rule, or second if the “required” rule is set; thanks Ovidiu Mihalcea
- fixed a bug where the developer could forget to set the “upload” rule for a file upload control; now, failing to do so will result in an error
- fixed a bug where the file upload control was not working in IE7; thanks to Ovidiu Mihalcea
- fixed a bug where the “required” rule could not be set for “time” controls; thanks to Adrian North
- fixed a bug where not selecting an option for a select box having the “multiple” attribute set, but no “required” rule, would trigger the spam filter; thanks to Faton Sopa
- fixed a bug where labels inside text boxes were vertically centered only for the default size of the controls; this behavior could be observed when setting different heights or padings for the text boxes;
- fixed a bug where if the process.php and mimes.json files could not be found by the script, the developer would not be able to set the correct paths through the assets_path() method, as the script was looking for those files in the constructor, and hence would break execution before executing anything else; thanks to Ovidiu Mihalcea;
- fixed a bug where the script would not be able to determine the paths to process.php and mimes.json files if PHP’s “allow_url_fopen” was not set to true; thanks to Andrei Bodeanschi;
- fixed a bug where file upload controls were submitted in the background on the “onchange” event even when the “upload” rule was not attached; also, the library will now trigger an error if a file upload control doesn’t have the “upload” rule attached;
- by default, for check boxes, radio buttons and select boxes, the library will prevent the submission of other values than those declared when creating the form, by triggering the error: “SPAM attempt detected!”; therefore, if you plan on adding/removing values dynamically, from JavaScript, you will have to call the newly added disable_spam_filter() method – available for check box, radio button and select box elements – to prevent that from happening;
- a new property of Zebra_Form is now available: “file_upload_permissions” which can be used to set the filesystem permissions for uploaded files;
- 12 hour format can now also be used for the “time” control; thanks to Marty
- changed the name of the “first_day_of_the_week” method (available for the “Date” control) to “first_day_of_week”; thanks to Edward for the feedback
- default padding for text boxes, text areas, passwords and selects was changed from “padding: 4px 3px 3px” to “padding: 5px” (in zebra_form.css) thus slightly increasing their size; note that this might break your layout, so be careful and change it back if it does so;
- updated Zebra_DatePicker to version 1.4
- most examples were updated
- some corrections and additions to the documentation;
- version 2.8.2 (May 11, 2012)
-
- the upload rule now has also a client-side validation side, where it checks if the indicated path exists and is writable
- fixed a bug for file uploads where, if the name of the uploaded file was too long, the “x” for canceling was not visible anymore
- fixed a bug where, after selecting a file, by clicking very close to the file’s name, users could open the file picker again, resulting in bogus visuals
- fixed a bug which made the file name not to appear for an upload control having “upload” as the sole attached rule
- updated Zebra_DatePicker to version 1.3.2
- fixed a bug where setting the first day of week as anything other than Monday was not working; all credit goes to Edward!
- version 2.8.1 (April 07, 2012)
-
- elements can now be validated “on-the-fly” where an element is validated as soon as it looses focus; use the newly added “validate_on_the_fly” flag for the “client_side_validation”; thanks to François Rigaudie and Konstantin Stoyanov
- all error messages can now be shown on form submit rather than only the first one; use the newly added “validate_all” flag for the “client_side_validation”; thanks to François Rigaudie and Konstantin Stoyanov;
- file names can now be prefixed with a given string when uploading files (using the “upload” rule); thanks to Robert Warelis;
- the library now triggers an error message if a “date” control doesn’t have the “date” rule set. note that this rule cannot be set automatically since it requires an error message to be set by the developer. thanks to bastian;
- the “length” rule, set with the 4th argument to TRUE, will now always show the character counter; previously, the character counter was shown only if the lower limit was 0. thanks to Andy Vogar;
- fixed a bug in the JavaScript code regarding the file upload control which was not working with jQuery UI. thanks to edward for fixing it;
- fixed a bug where validation would fail if there were two or more file upload controls on a form. thanks to edward for fixing it;
- fixed a bug where the class for disabled control was not correctly applied;
- updates in documentation
- updated Zebra_DatePicker to version 1.3.1
- version 2.8 (March 10, 2012)
-
- fixed a bug where the attach_tip() JavaScript method was not working properly; thanks to Andrei Bodeanschi
- previously, the placeholders were injected to the bottom of the main document rather than right after the parent element and thus generating issues like placeholder remaining visible when hiding the parent element’s container; now the placeholders are injected in the DOM right next to the parent element;
- fixed a bug where because of the fact that JavaScript and PHP treat new lines, accented characters and special characters differently (1 byte in JavaScript and 2 or 3 bytes in PHP), server-side validation of a maximum allowed length would sometimes fail if a textarea’s value would contain new lines, although client-side validation was ok; thanks to Andrei Bodeanski for spotting it;
- fixed a bug where setting the “readonly_element” property to FALSE on a date element had no effect; thanks to bastian
- fixed a bug where a date element’s “get_date” method was triggering a warning if the the element was not required and no date was selected; thanks to bastian
- the “length” rule now accepts a 5th argument instructing the script to show a counter of remaining characters;
- added a new method available for text, textarea and password controls, called change_case which can be used to instruct the script to force all letters typed by the user, to either uppercase or lowercase, in real-time;
- added documentation on how to access the Zebra_Form object in JavaScript, with examples;
- added documentation on how to use AJAX in custom validations (scroll down to the “custom” rule and keep reading);
- tweaked the default CSS style of the date control which was a bit too short;
- updated Zebra_DatePicker to version 1.2
- version 2.7.7 (January 18, 2012)
-
- fixed a bug that made disabling dates impossible; thanks to Andrei Bodeanschi
- fixed a bug with the “convert” rule that made it always delete the converted image immediately after conversion, if the “overwrite” argument was set to TRUE
- added albanian translation; thanks to Faton Sopa
- version 2.7.6b (December 06, 2011)
-
- fixed a bug where placeholders (labels used as “hints” inside text/password/textarea controls) would not follow their parent control upon resizing the browser window;
- sometimes error messages get stuck and cannot be closed; although I couldn’t find the root of the problem I’ve done some tweaks and it seems to be working a bit better now (especially error messages related to file upload controls). the whole logic around error messages needs to be rewritten tough, as I realized that there are some faulted approaces there.
- version 2.7.6 (December 06, 2011)
-
- fixed a bug that appeared since the last version that made file uploads to never pass validation
- version 2.7.5 (November 20, 2011)
-
- fixed a bug where using multiple forms on a single page would disable client-side validation for all forms but the first one; thanks to Pedro Abreu for reporting;
- fixed a bug where if there were selection groups in a select, it would never pass validation;
- fixed a bug where placeholders (labels as hints inside textboxes and textareas) were not working on textareas; thanks to Chris for reporting it a long time ago and to Andrei Bodeanschi for recently reminding me about it;
- elements that have display:none or visibility:hidden are no longer checked in the client-side validation process;
- the Zebra_Transform plugin is not included anymore in the library; it can be downloaded and used separately from here if needed; as a result, the form’s fancy_form() method is also gone;
- some additions to documentation;
- version 2.7.4 (September 27, 2011)
-
- fixed another bug that would make date validation impossible in certain scenarios;
- minor updates to the JavaScript code;
- version 2.7.3 (September 16, 2011)
-
- fixed a bug where dates having the day < 10 would not pass validation; thanks to Dev for reporting;
- fixed a bug where Zebra_TransForm was incorrectly initialized and was transforming controls on the entire page rather than just the current form’s controls
- fixed a bug that made impossible to set custom classes for the actual <form> tag, through the form’s constructor method; thanks to Sebi Popa for reporting;
- fixed a bug that would cause the script to trigger a warning when a select control would have [] (square brackets) in its name but the multiple attribute was not also set;
- fixed an issue that allowed malicious users to submit arbitrary values instead of the ones defined at the form’s creation, for select controls, checkboxes and radio buttons; the severity of the issue was low as the submitted values were still filtered for cross-site scripting (XSS) attempts, so no real harm could be done; thanks for PunKeel for reporting;
- previously, the library would rely on information available in the $_FILES super-global for determining an uploaded file’s mime type, which, as it turns out, is determined by the file’s extension, representing a potential security risk; now, for PHP versions 5.3.0+ compiled with the “php_fileinfo” extension, the uploaded file’s mime type is determined using PHP’s finfo_file function; thanks to DaveK for reporting;
- now the script throws a JavaScript error if the JavaScript function required by a custom validation doesn’t exists; previously, it would silently ignore the fact;
- updated the Zebra_DatePicker to version 1.1.2
- updated documentation to reflect the recent changes in the Zebra_Image library
- version 2.7.2 (August 29, 2011)
-
- fixed a bug in the date picker’s JavaScript code regarding event delegation that would crash the script in certain scenarios; thanks to Sebi Popa for spotting it!;
- version 2.7.1 (July 30, 2011)
-
- fixed a bug where date would never validate for languages other than English; thanks to alfred;
- the form now completely adheres to http://www.w3.org/TR/WCAG20-TECHS/H44.html which requires that all controls have an associated label; previously, the honeypot element did not have an associated label. thanks to Alexis;
- minor optimizations in the PHP code;
- some clarifications in the documentation regarding the “resize” rule;
- version 2.7 (July 19, 2011)
-
- added a new validation rule called filetype; with this rule one can restrict the types of files that are upload-able by specifying a list of allowed file extension; it’s important to note that validation is not done by file extension but by the MIME type of the uploaded files; for this, a new file is available in the root of the library called mimes.json containing the currently supported extensions and associated MIME types;
- the library now makes use of the Zebra_TransForm jQuery plugin to replace radio buttons, check boxes and select boxes with nicer ones; see the newly added “fancy_form” method for configuration;
- due to popular request CAPTCHA images are now easier to read;
- if the script was run on a virtual host, it could not correctly determine the path to the “process.php” file (this file is used for validating uploads client-side and for CAPTCHAs);
- fixed a bug that would break the file upload control when the form name had dashes in it (i.e. “my-form”); thanks to MarcosBL;
- fixed a bug that was introduced in the previous version that made disabling the client-side validation impossible;
- fixed a bug that caused the name of the uploaded file to appear in the wrong position;
- fixed a bug where the “date” control’s “get_date” method was returning a string enclosed in an array rather just the plain string;
- fixed a bug where the “date” control’s “direction” method was not working when using “false” as argument;
- some clarification in the documentation regarding the upload rule;
- some clarification in the documentation regarding the set_attribute method; thanks to Jack Ryan;
- added French language file; thanks to Sébastien GASTARD;
- added German language file; thanks to Chris Banford;
- version 2.6.1 (July 01, 2011)
-
- fixed a bug where the settings for client-side validation would get reset if a file upload control was added to the form. thanks to kszys for reporting.
- fixed a bug where the client-side validation would crash when the format of the date contained day names or month names. thanks to Chris for reporting.
- fixed a bug where determining the path where the library is located (for executing the process.php file required for AJAX-like uploads) was not working for certain configurations. thanks to kszys for helping.
- fixed a bug that would crash the script if date format would contain “/” (slashes) – thanks to Jack Ryan for reporting
- fixed a bug where the length rule was tested even if the element had no value nor was the required rule set. unless the required rule is set, the length rule is not to be tested as long as there is no value entered.
- additions to the documentation of radio buttons and checkboxes. thanks to kszys the suggestion.
- additions to the documentation of the “upload” rule where it is now stated that after the rule is run, the DOM element the rule is attached to will get an attribute called file_info which will contain information about the uploaded file, usable in the JavaScript part of a custom function.
- Spanish language file added – thanks to José Machado for providing it
- version 2.6 (June 24, 2011)
-
- fixed a bug that broke the “resize” rule (thanks to jose for reporting)
- added an extra example for the “resize” rule on how to create multiple sizes of an uploaded image by using the resize rule.
- version 2.5 (June 21, 2011)
-
- fixed a bug where the labels inside controls were not working in Internet Explorer prior to 9
- corrected the documentation about how to access the JavaScript object (thanks to Jonathan Kratzke for reporting)
- version 2.4 (June 20, 2011)
-
- fixed a bug where the regexp rule was not working if the regular expression contained parentheses (thanks to Sebi Popa and to Dragos Oancea for reporting)
- version 2.3 (June 19, 2011)
-
- fixed a few bugs related the “date” control (thanks to Jack Ryan for reporting)
- fixed a bug that affected file upload validation
- version 2.2 (June 11, 2011)
-
- fixed a bug where, for custom validations, the JavaScript function was not getting any additional arguments except the element’s value (thanks to Robert Grzesinski for reporting)
- fixed a bug where the “date” control would add an invalid attribute to the element that would cause the generated output not to pass the W3C validation
- fixed a bug where in the newest versions of PHP 5 the script would generate “PHP Strict Standards” notices because of how mktime() (with no arguments) and array_shift() is treated in these versions
- some documentation updates and clarifications (thanks to Andrei Bodeianschi for suggesting some of those)
- version 2.1 (June 02, 2011)
-
- ported the client-side validation to jQuery
- the “date” control has some new methods thanks to the integration with the Zebra_Datepicker jQuery plugin
- regardless of the format used for a date, the submitted date can now easily be retrieved in YYYY-MM-DD format for use with a database or with PHP’s strtotime function by using the newly added get_date() method;
- Zebra_Form was not working if the jQuery was loaded at the end of the page (thanks to Sebi P for reporting)
- fixed a bug with custom validation rules
- fixed a bug with “selects” having the “other” option set
- version 2.0 (April 10, 2011)
-
- added client-side validation. requires MooTools 1.2.5+
- added automatic handling of file uploads. the script can now automatically upload files to a specified folder. it can also automatically check for valid image files, permitted file size and it can also automatically resize uploaded images (requires the Zebra_Image class)
- a new method is now available: reset() which clears the values of all the form’s controls
- added a new control type: “time”; this outputs a time picker
- controls now have rounded corners (in browsers that support CSS3) and have a :hover state
- infinite levels of nested option groups can now be created for “select” controls (until now, only one level could be created);
- select controls now have a default, language dependent, “- select -” option
- select controls can now have a new attribute: “other”. when set, a text box control will be automatically created having the name “[control_name]_other” (where [control_name] is the name of the select box). the text box will be hidden until users select the automatically added “Other…” option from the selectable options.
- dropped XTemplate templating engine in favor of pure PHP templating
- the generated HTML validates as HTML 4.01 Strict. If you want it to validate as XHTML 1.0 Strict use the newly added doctype() method
- access keys can now be set for labels
- added a bunch of new validation rules
- improved CAPTCHA control
- a new “control” is available – you can now add “notes” (information boxes telling the users what they are expected to enter/select in a field) in the same way as adding “labels”
- fixed a bug regarding XSS prevention
- fixed a bug where the “number” rule would not allow the input of negative numbers
- fixed a bug where the “compare” rule would validate when the values was compared to that of a nonexisting control
- fixed a bug where option groups couldn’t be created for the “select” control
- fixed a bug that appeared since the last release that caused emails to never pass validation
- fixed a bug that would not render the captcha image on some systems
- many documentation refinements
- version 1.2 (September 22, 2008)
-
- a new feature has been added: automatic output generation. if your form does not need any special output format, you can simply call the render() method without specifying a template name to let the script handle it, thus saving you some time as you are not needed to also code the form’s layout.
- a new type of controls has been added: “html”. with this you can insert arbitrary HTML code into your forms. This is usefull when you don’t use templates but rather let the script generate your forms and you need to have some extra HTML in your forms (notes, descriptions, etc) – because letting the script to automatically generate your forms means that you don’t have a template to insert your HTML code into
- arrays of custom rules can now be set for controls; up until now, only one custom rule per control could be set
- generated forms are now (more) W3C compliant
- CAPTCHA is now case insensitive
- default template is now nicer
- better error reporting
- fixed a few minor bugs
- many documentation refinements
- version 1.1.1 (May 08, 2008)
-
- rewritten css for the default template
- fixed a bug where submitting array-like controls (multiple checkboxes with sharing the same name or a “select” control with “multiple” set) would crash the script
- fixed a bug where submitting text fields with empty spaces would pass the validation for “required” fields
- fixed a bug where the captcha image was not updated upon submission
- upon submission, all characters were transformed to their applicable html entities, which could cause a lot of headaches if you were submitting text in other language than english
- version 1.1 (December 03, 2007)
-
- added *heavy* XSS (cross site scripting) injection prevention (the class used for filtering for XSS injection is the Input class from the CodeIgniter PHP framework
- previously some accented characters got scrambled upon submission as htmlentities() was being called without the UTF-8 argument
- fixed an error where, when having multiple forms on a page, all forms were processed upon submission
- version 1.0 (June 02, 2007)
-
- trying to change the main template of the class had no effects
- the class was not working correctly in PHP 4.x.x
- fixed an error where using a nonnumeric index for the first element in a “select” control (indicating the “nothing selected” condition of the control) would lead to a crash
- added validation rule for a list of comma separated email addresses
- many people have asked for it so i’ve added an example on how to use the radio controls, the checkbox controls and on how to do quick custom validations
- multiple instances of the form could not be created on the same page
- error messages can now be customized from the main template (the one in the /templates folder) – thanks to Claude Quezel for suggesting
- custom blocks can now be parsed in the form’s template by using the newly added “parseBlock” method
- the “addOptions” method of the “select” control was overwriting any previously set options. now subsequent calls to this method will append options to the existing ones
- custom form actions can now be specified – previously, forms were always submitted to themselves
- a new property was added: “locked”. by default, when a form is reloaded after a submission, all the controls will have their respective submitted value, while the default value set by user will be ignored. setting this property to TRUE, will make the controls preserve their user-provided default values, ignoring the submitted value
- previously, only variables could be passed to the addVar method. now strings and constant can also be passed
- multiple options can now be preselected for select controls having the “multiple” attribute set (read the documentation for the constructor of select controls) – this one was actually working just wasn’t documented. thanks to sridhar for reporting
- in order to make the generated output valid XHTML 1.0, the label controls no longer have the “name” attribute and the form has now the “action” attribute set; also the “selected” attribute is now correctly set for “select” ontrols (thanks to Claude Quezel)
- made some changes in the main template’s CSS file, provided by Claude Quezel, that makes the fieldsets look in the same way in Firefox and Opera as in IE – thanks!
- on some PHP installations file upload was not working (enctype and max_file_size were not being set)
- version 1.0 BETA 3 (February 17, 2007)
-
- for the “select” control, if options were specified having literal keys and the “required” rule was set, the control would never pass validation (thanks to sridhar for reporting)
- a major security issue was fixed where an attacer could inject arbitrary HTML and/or JavaScript code along with the submitted data. now all the submitted data is passed through the htmlentities() function and, if magic_quotes are on, are stripslashed (thanks to Bartosz for reporting)
- file uploads were not working because neither “enctype” nor MAX_FILE_SIZE were set upon the rendering of the form
- if you would set a checkbox’s state as “checked” by default, any subsequent submits would set the checkbox’s value to “checked” even if user would uncheck it (thanks to sridhar for reporting)
- “required” rule could not be set to the “file” control (thanks to sridhar for reporting)
- a new method was added: “addVar()”. through this method, user defined variables can be made accessible from within the form’s template file
- added a new control: “captcha” which generates CAPTCHA images
- password controls no longer re-display the entered value
- version 1.0 BETA 2 (January 05, 2007)
-
- fixed various bugs in code, example and documentation;
- in Firefox, trying to open the date picker would produce a JavaScript error;
- the icon for opening the date picker was not visible in Firefox;
- version 1.0 BETA (December 19, 2006)
-
- initial release;





I am a 32 year old web developer working from Bucharest, Romania. I am coding since I was 14 and I am extremely passionate about it. For the server side of things I use PHP/MySQL while on the front-end I write valid HTML 5, nice CSS and lots of JavaScript code using jQuery.
Hello Stefan
First off i would really like to say awsome job with Zebra Forms.
I have a question with the set rule upload.
‘upload’ => array($upload_path, $preserve_original_name, $error_block, $error_message)
Is there any way for me to set a custom name for the file upload or do i only have the choice of “orginal file name” or random?
My second question is after form is validated i call echo $file_upload. (if ($form->validate()) echo $file_upload;) i should be able to see path and filename). After form has been successfully submitted i get that array blank. Am i calling it wrong spot? Using it wrong?
If theres any way to shed some light on this situation?
Thanks very much for everything and keep up the good work
Robert
ReplyThere’s currently no way of setting file name other than preserve the original name or generate a random one; you have a point, and I’ve added your request to my todo list – thank you.
Second, $file_upload is not a global variable but a property of the Zebra_Form object, so you have to call it like $form->file_upload
I would just like to say thank you very much for such a quick response. $form->file_upload worked perfectly. Im glad my request has been taken into consideration and looking to see it in a future update.
Thanks once again for doing such a great job.
Robert
I’ve been continuing to develop the form I’m working on and while most everything is going well, I came upon another problem. I want to allow users to upload up to 3 files. If I upload no files or 1 file, then all works well. If I upload 2 or 3 files then it passes the client side validation for filesize and filetype, but then I get a server side filetype validation error when I submit the form. So they’re passing validation when I select the files to upload, but failing when I actually submit the form.
I’ve done some looking through the code in Zebra_Form.php and here’s what I found. Line 2869 starts the filetype validation. Lines 2885-2939 is a conditional section that loads the file with the mime types if it hasn’t been loaded already. Included in this conditional section are lines 2890-2900 that gets the filetype of the uploaded file. So for the first file uploaded, all works well. The mime types file is read in and the filetype of the uploaded file is determined. However, when it gets to the second uploaded file, it skips this section because the mime types file has already been read, but also skips the section where the filetype of the second uploaded file is determined.
Just to see whether this is indeed what was happening, I went to line 2983 and inserted this line:
unset($this->mimes);
That way it would always run the conditional section where the mime types are read in and the filetype of the uploaded files are determined. I was then able to successfully upload 2 or more files.
A better way I think is to move lines 2890-2900 out of the conditional section and put them just after the conditional ends at line 2940. I did that and all worked well. Does this seem like the right thing to do or am I missing something? Thanks for all your hard work. I’ll be checking out some of your other libraries and plugins after I get this form finished.
Replythanks again for finding an ugly bug!
the proper fix is to move lines 2902-2939 (inclusive), right after line 2888.
Stefan and others:
Has the honeypot method been effective to stop spammers and bots from submitting Zebra_forms?
Thanks in advance for your comments!
Replyyes, it worked wonders for me on stopping bots
Hi Stefan. Is there a way (and if so, how do we go about it) to have the form submit via ajax ideally replacing the forms contents with the ajax response.
ReplySee the documentation (scroll down to the second example). In the “if ($form.validate())” block send the form through AJAX and then replace it.
Hello Stefan,
I would like to thank you for this great library. It is very easy to use and the forms look beautiful.
ReplyHi Stefan, Just starting out with web stuff (been desktop programming for 30 years) and got your stuff working using localhost (MAMP). It looks fabulous. When I upload it to my web site it looks as though the style sheet is being ignored (?) so the formatting is not nice. I am stumped now; been at it four hours. Any thoughts would be welcome
Replyhave you loaded Zebra_Form’s CSS file? have a look in Firebug’s “Net” tab and see why files are not loaded (marked with red), and where the browser’s looking for them
Hi Stefan
I feel a bit of a chump now. Loaded Firefox and ran the same example and it worked fine. Ran again in Safari and again it was Ok. Not sure what went wrong before but all Ok now. Sorry to have bothered you. And thanks also for the quick reply. It helps to know there is someone there if I get stuck. All the best, Paul
Hi. Thanks for this library. It looks great.
I’m having some trouble integrating this with WordPress though. I’m writing a wordpress plugin and using this library to create/validate forms on admin pages. However, the date picker doesn’t seem to be working and I can’t figure out why. I’ve viewed the source to make sure all the dependencies are loading properly, and they are. Do you know of any reason why one would get into trouble using this on wordpress admin pages?
Replyare you sure you are including zebra_form.js and not zebra_form.src.js? (the latter doesn’t contain the Zebra_Datepicker plugin); what JavaScript errors is Firebug (or similar tool, depending on your browser) showing to you?
Is there a way to switch the time field to 12hr instead of 24hr.
If not, could we define the value of the hours shown? I have it manually showing 8-5. 1 is automatically 1am though.
I tried with ’13′ =>’1′ but it didn’t work.
Thanks
Replythere’s currently no way for doing that, but you do have a valid point – i’ve no idea why i didn’t think about that. it will be in the next release, by the end of the next week. thanks!
Hi Stefan,
The Select option control having a bug. say for eg:
if add_options array default assumption is:
Array
(
[0] => Marketing
[1] => Operations
[2] => Customer Service
[3] => Human Resources
[4] => Sales Department
[5] => Accounting Department
[6] => Legal Department
)
And if you give index values starts with 1, it wont work and say spam attemp detected!
Array
(
[1] => GHSS
[2] => st.mary’s
[3] => jyothis
[4] => Amrita vidhyalayam
)
Help me to fix this.
pm on my email.
from,
ReplySajan
sorry, I can’t confirm it…
show me the exact PHP code you are using for the select box and what is the selection you make that triggers the error
First of all, I want to thank you for this great work.
I almost completed my form but I go crazy for 2 days to upload my file.
My code is as follows:
/ / File Upload
$ form-> add (‘label’, ‘label_fichier’, ‘file’, ‘File to attach: “);
$ obj = & $ form-> add (‘file’, ‘file’);
$ obj-> set_rule (array (
‘filesize’ => array (’102400 ‘,’ error ‘,’ File size must not Exceed 100Kb! ‘)
‘filetype’ => array (‘jpg, xls, pdf’, ‘error’, ‘Not a valid Excel, PDF or JPEG file!’)
‘upload’ => array (‘tmp’, ZEBRA_FORM_UPLOAD_RANDOM_NAMES, ‘error’, ‘File Could not be uploaded!’)
));
I can well recover all data in $ _FILES ['file']['...'], but when I select a file to send, this has the effect of opening a blank page ….. process.php and ajax loader runs in loop without displaying the file upload in the field.
Also controls the filesize and filetype is not working, suffering any error message!
As beginners in POO, I think there is definitely something I should do wrong.
Ps: Just to clarify, I work on a local server “Wampserveur”.
Please help me !
ReplyThank’s in advance!
Steve
make sure you don’t have some other JavaScript error that breaks the whole system; check firebug’s console tab for that; create a separate form containing just the file upload control and see if it works – if it does, it is something else that’s breaking your code; also, what does firebug’s “net” tab tell you: does the script find process.php? if it doesn’t (its shown in red) use the assets_path method for specifying the correct path to process.php; if it does find process.php, make sure you actually have the “tmp” folder as a subfolder of you app’s working folder; also, check the firebug’s “console” tab and check the response of the ajax call to process.php and check if it returns a JSON;
Thank for your prompt reply ,
but it was just the Quirkmode which was activated in IE.
Hi Stefan. I’m having an issue with the spam detection falsely preventing the form submitting a login form for some members and would like to know if there is a way to disable it
ReplyJust an update. I have discovered that something on these members computers is filling in the honeypot field. Has anyone else had this issue and knows what causes it?
I haven’t had this issue so far; an auto-fill script should not fill the honeypot field…and disabling the honeypot field would just bring chaos and doom!
Hi. I’ve added a date field to a form and I want to set the datepicker to start with Sunday instead of Monday. It should be a very simple task to use the first_day_of_the_week function and set it for day 0. However, no matter what I try, the first day stays on Monday. I checked your datepicker page to see whether there was a demo there for this, but there wasn’t. I did try your demo #3 where Saturdays and Sundays should be disabled, but only Sundays were disabled with Saturdays still selectable. So something is not working in your demo and I’m wondering whether there is a common bug that might also be causing a problem with the first_day_of_the_week function. I’m able to use the other functions, such as direction and format so I’m sure I’m doing things correctly. It’s just not working. Any suggestions? Thanks.
ReplyI’ve checked the “first_day_of_the_week” property and seems to be working; The bug where Saturdays and Sundays should be disabled was already fixed in Zebra_Datepicker but Zebra_Form was using of the previous version of the date picker (this website uses the date picker from Zebra_Form and that’s why the bug was still on the website). I’ve uploaded the newest version of Zebra_Form – featuring the latest version of Zebra_Datepicker – download it and let me know if it fixed your problems. Thanks!
I tried your updated version 2.8.2 and I still couldn’t set the first day to anything other than Monday. I looked into it a bit further and I think I see the problem. At least I’ve gotten it to work. In the file includes/Date.php, the attribute is called first_day_of_the_week, but in public/javascript/zebra_form.js, it is called first_day_of_week. I went through the zebra_form.js file and changed them all to first_day_of_the_week to match Date.php and now it works.
thanks a lot! i’ve patched the bug and the patched version is now available for download. your name is in the changelog now!
Did this fall through the cracks? I downloaded the latest version of zebra_form (2.8.2) and in public/javascript/zebra_form.js, you still have first_day_of_week instead of first_day_of_the_week. After I downloaded the latest version, then all the datepickers went back to Monday as the first day. I swapped things out in zebra_form.js and it’s working again. So it looks like the fix never made it to the distribution zip file.
thanks! apparently I didn’t change all occurrences of “first_day_of_the_week” to “first_day_of_week” (which is how the Zebra_Datepicker expects it). And the problem was in includes/Date.php file. Download the zip again and it should work this time. thanks again!
Thanks again for dealing with this. I was going at it from the other direction, but as long as everything is named the same, it seems to work. One thing I see is that if you set the first day of the week using the function, the name of the function is first_day_of_the_week:
$date = $form->add('date', 'date');
$date->first_day_of_the_week(0);
But if you do it all in the constructor, then the attribute is first_day_of_week:
$date = $form->add('date', 'date', '', array('first_day_of_week'=>0));
Seems like everywhere else you have the function and the attribute named the same, which makes things a little easier to remember. But it’s not a problem as long as I know which to use for each situation. Thanks again. The more I use these forms, the more I like it.
aaargh – i didn’t realize that you can also use it from the constructor!
I left the name of the function unchanged so that it won’t break anything for people who are updating the library. But, in this new light, the name of the function *will be changed* in the next release to “first_day_of_week”. thanks a lot for taking the time to write back and for helping me making the library better
Hi, what about HTML5′s “range”, “number” and other input
(they generate greater user interface
)
Thanks
ReplyI would like to get your insight into dynamically setting or removing validation rules. Here’s what I’m trying to do. I have a select box with some options. If the first option is selected, I’d like another select box to appear with choices related to that selection. If the second option is selected, I’d like 2 text boxes to appear where the user can enter more information. I have this functionality working OK. I get the select box or text boxes appearing and disappearing when they should.
The problem is with validation. If the first option is selected, then I’d like the second appearing select box to be required. If the second option is selected, then I’d like both appearing text boxes to be required. I can set the validation rule for all of them to be required initially, but when the form is submitted, even if one of these controls is still hidden, then it generates a validation error. So what I’d like to do is be able to set a validation rule for a control when it’s visible and remove it when it’s not. You’re doing something similar with the ‘other’ text box that appears when Other… is selected from a select box. Can I do something similar as I’ve described? Or can I use javascript to get at your validation_rules object so I can set and unset rules dynamically? Thanks for any thoughts you might have. I appreciate how good you are about responding to these things. -Edward.
ReplyWouldn’t you know, as soon as I sent this I came upon the custom validation. Does exactly what I need. Please disregard my previous message and I promise I’ll look a little harder next time.
Hello,
your library is just beautiful work.
so i’ve just a little question.
is it possibly to get like two button or two field in the same row and not one under another?
this thing would be great i think ( or maybe i have missed this functionnality ^^)
ReplyFinally i’m just like an blind man i’ve found the way to do custom template at second i post my question XD.
So great job with that library