[Koha-bugs] [Bug 6209] Standardize on one javascript library for client-side form validation

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Mar 1 16:17:19 CET 2013


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=6209

Owen Leonard <oleonard at myacpl.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #15141|0                           |1
        is obsolete|                            |

--- Comment #12 from Owen Leonard <oleonard at myacpl.org> ---
Created attachment 15802
  -->
http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=15802&action=edit
Bug 6209 [Revised] Standardize on one plugin for client-side form validation

This patch adds the jQuery "Validation" plugin
(http://docs.jquery.com/Plugins/Validation) and includes it by
default in the staff client along with an include file containing
translatable strings for all of the plugin's possible messages.

The staff client's main JavaScript file has been modified to perform
automatic validation of any form with the class "validated."

For a simple example I have modified the library entry form
to mark required fields as required (something which had not
been done before). Each required field has been given a class,
"required" and the HTML5 attribute "required." The former adds
the hook for the plugin, the latter adds browser-based validation
in recent browsers (and which will be superceded by the plugin
if JavaScript is enabled).

This will check for inputs classed "required" without any
additional configuration. More complex forms (with specific
data types, for instance) will require more inline JavaScript
configuration.

$("#FormID").validate({ /* configuration details */ });

Also added to the library entry form are checks on the email and URL
fields via classes ("email" and "url", respectively). This demonstrates
validation of content without forcing the field to be required.

To test, go to Administration -> Libraries and Groups and choose
"New library." Submit the form without entering a library code
or name. You should be prevented from submitting the form and be
shown an error message by each field. Perform the same check with an
existing entry.

To test browser-based validation, disable JavaScript and follow
the same procedure.

Revision rebases the patch against current master and adds missing
"//<![CDATA["

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are watching all bug changes.


More information about the Koha-bugs mailing list