# inputEx - Using the YUI loader

## How to use the YUI loader

InputEx modules and dependencies are defined in the inputex-loader.js file. See the YUI loader page for more informations.

// in your HTML: <script src="../lib/yui/yuiloader/yuiloader-min.js"></script> <script src="../js/inputex-loader.js"></script> /** * The function to call when all script/css resources have been loaded */ function init() { // Required for the UrlField inputEx.spacerUrl = "../images/space.gif"; new inputEx.Form( { fields: [ {type: 'select', label: 'Title', name: 'title', choices: ['Mr','Mrs','Ms'] }, {label: 'Firstname', name: 'firstname', required: true, value:'Jacques' }, {label: 'Lastname', name: 'lastname', value:'Dupont' }, {type:'email', label: 'Email', name: 'email'}, {type:'url', label: 'Website',name:'website'} ], buttons: [{type: 'submit', value: 'Change'}], parentEl: 'container1' }); }; var loader = new YAHOO.util.YUILoader({ require: ["inputex-emailfield", "inputex-urlfield", "inputex-selectfield", "inputex-form"], loadOptional: true, //base: "../lib/yui/", // remove the comment if you want to load YUI locally onSuccess: init }); /** * Important: this functions declares all inputEx Modules to YUI */ YAHOO.addInputExModules(loader, '../'); loader.insert();