[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
Thu Mar 22 15:40:25 CET 2012


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

--- Comment #4 from Julian Maurice <julian.maurice at biblibre.com> ---
Created attachment 8520
  -->
http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=8520&action=edit
Another form validation plugin (Ketchup)

I just wanted to propose another form validation plugin, Ketchup.

It seems that both can achieve the same job (they're both translatable and
highly customizable), but I don't like the way we have to declare "validation
instructions" in HTML tags with Validation plugin: some of them can be declared
in class attribute (which is designed for styling), and others have to be
declared in separate non-standard attributes (eg: minlength="2") (by the way,
how do we declare "instructions" with more than 1 parameter? the documentation
is not clear about this).
To avoid this, Validation plugin provide a way to declare these "instructions"
in another attribute, like 'data-validate' for example, but looking at the code
it seems that it requires Metadata plugin which has been integrated in jQuery
since 1.4 (and ($.metadata) returns "undefined" with jQuery 1.7.1)

With Ketchup, "validations instructions" are declared like this:

<input type="text" name="foo" data-validate="validate(required,minlength(3))"
/>

Documentation and demos can be found here:
http://demos.usejquery.com/ketchup-plugin/index.html
Source is here: https://github.com/mustardamus/ketchup-plugin

Patch attached shows a demo on the same page that previous patch for Validation
(admin/branches.pl)
It includes Ketchup plugin, a CSS file, and the latest version of jQuery
(Ketchup doesn't work with jQuery 1.3.2 :/)

-- 
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