YUILibrary - Open source JavaScript and CSS for building richly interactive software.
Fork YUI on GitHub
  • Home
  • Gallery
  • Forums
  • YUI 2
  • YUI 3
  • YUICompressor
  • YUIDoc
  • More
  • Gallery Forums
  • Gallery Stats
  • Gallery Calendar
  • Register
  • Login

Modules

  • Home
  • Featured
  • Popular
  • New
  • All

Documentation

  • FAQ
  • Developer FAQ
  • Developer Guide
  • Module Setup

Context Navigation

    YUI Library is not responsible for bugs or support with this module. It is available as a free service. For support please contact the module owner with the provided links.

    Form Validator (gallery-formvalidator)

    Last Updated: 12/7/09
    + 1 -

    Murray Macchio

    YUI Contributor

    Created: 11/10/09
    Last CDN Push: 11/19/09
    Build Tag: gallery-2009.11.19-20
    Project: YUI 3
    License: YUI BSD
    YUI Version: 3.0.0
    Free for use.

    This non-instrusive component will change your regular forms into highly interactive forms. Fields filled in incorrectly will be highlighted as incorrect, while inputs filled in properly will be shown as correct. Fully customizable, use your own CSS to mark fields as valid or invalid.

    Main features include

    • Dynamic creation of field indicators (valid/invalid)
    • Define your form's validation with JSON, or with inline HTML attributes
    • Integrates easily with any AJAX module for asynchronous form submission.
    • Has fully customizable password entry field which will require a minimum strength of password
    • Custom inputs where you define your own functions.
    • Regular expression support.

    See full documentation here
    http://murdog05.github.com/yui3-gallery/docs/module_validator.html

    • Tags:
    • validator
    • validation
    • client-side
    • murdog05
    • form
    • Download
    • Docs
    • Homepage
    • Bugs
    • Source
    • Example
    • Forum
    • History

    Below is for a simple html page in which you want the form validator to do all the work. It will create all the validators. See here for example

    http://murdog05.github.com/yui3-gallery/examples/json/dynamicValidatorsExample.html

    See the inline equivalent here

    http://murdog05.github.com/yui3-gallery/examples/inline/dynamicValidatorsExample.html

    Code Sample

    YUI({
        modules: {
            'gallery-formvalidator': {
                fullpath: 'http://yui.yahooapis.com/gallery-2009.11.19-20/build/gallery-formvalidator/gallery-formvalidator-min.js',
                requires: ['dom','node','event','base'],
                optional: [],
                supersedes: []
          }
     
        }
    }).use('gallery-formvalidator', function(Y) {
                 var form2 = new Y.Validator(
                            {
                                form:'basicExample2',
                                defaultIndicatorDomType:'DIV',
                                defaultIncorrectIndicatorCss:'validator',
                                defaultCorrectIndicatorCss:'indicator',
                                createCorrectIndicator:true,
                                createIncorrectIndicator:true,
                                correctIndicatorText:'<span class="indicator"> </span>',
                                incorrectIndicatorText:'<span class="validator"> </span>',
                                fieldJSON:[
                                    {
                                        type:Y.TextBaseField,
                                        atts:{
                                            inputDOM:'firstName2'
                                        }
                                    },
                                    {
                                        type:Y.TextBaseField,
                                        atts:{inputDOM:'lastName2'}
                                    },
                                                                    {
                                        type:Y.DoubleField,
                                        atts:{
                                            inputDOM:'income2',
                                            max:40000.00,
                                            maxDecimalPlaces:2
                                        }
                                    },
                                    {
                                        type:Y.IntegerField,
                                        atts:{
                                            inputDOM:'age2',
                                            max:100,
                                            min:10
                                        }
                                    }
                                ]
                            }
                        );
    });

    Forum Posts

    Subject Author Date
    Any comments suggestions or feedback Murray Macchio 11/25/09
    Re: Any comments suggestions or feedback Murray Macchio 11/25/09
    Re: Any comments suggestions or feedback Eric Miraglia 11/25/09
    YUI Projects
    • All YUI Downloads
    • YUI 2
    • YUI 3
    • YUIDoc
    • YUICompressor
    • YUILibrary.com
    • YUI Build Tool
    • YUI PHP Loader
    Pages & Links
    • All YUI Downloads
    • Git FAQ
    • Graded Browser Support
    • Contribute to YUI
    • Forum Stats
    • Gallery Stats
    • YUI Calendar
    Contribute
    • Submit a Bug
    • Request a Feature
    • Write Code
    • Meet the Team
    Follow YUI
    • on GitHub
    • on Twitter
    • on FriendFeed
    • on Facebook
    • on IRC
    • YUI Blog
    • YUI Theater
    • YUI Forums

    © 2010 YUI Library - Site Credits