Fork me on GitHub

Example: Basic type field creation

How to create a type field.

Basic TypeField creation

The TypeField provide an interface to create a custom form.

Setting the value

The value returned by a TypeField is a JSON configuration for an inputEx field. Here's how to load such a value :

HTML

<div id="field-container"></div>

JavaScript

Implementation

YUI().use('inputex-type','inputex-url',function(Y) {

    new Y.inputEx.TypeField({parentEl: 'container1'});

    new Y.inputEx.TypeField({
        parentEl: 'container2',
        value: {
            type:'url',
            label: 'Website',
            name:'website',
            placeholder: 'Enter a URL',
            size: 30,
            description: 'You can provide a default value to TypeField',
            value: 'http://developer.yahoo.com/yui/3/'
        }
    });

});