Fork me on GitHub

Example: Basic uppercase field creation

How to create a uppercase field.

Basic UpperCaseField creation

Use the following code to create a basic inputEx UpperCaseField.

HTML

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

JavaScript

Implementation

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

    var field = new Y.inputEx.UpperCaseField({parentEl: 'container1', value: 'i was lowercase'});

    var el = Y.one('#container1');

    var button1 = Y.inputEx.cn('button', null, null, "SetValue with 'InputEx'");
    var val = 'InputEx';
    el.appendChild(button1);
    Y.one(button1).on('click' ,function() {
       field.setValue(val);
       val = (val == 'InputEx') ? '' : 'InputEx';
       button1.innerHTML = "SetValue with '"+val+"'";
    });

    var logDiv = Y.inputEx.cn('div', null, null, "Log :");
    el.appendChild(logDiv);
    field.on('updated', function(value) {
        logDiv.innerHTML += "Updated at "+(new Date())+" with value "+value;
        logDiv.appendChild(Y.inputEx.cn('br'));
    });

});