public/javascripts/inputex/js/fields/MenuField.js
function() {
	   
	   // Keep corresponding text for each value selectable in the menu
	   //   -> will be used to display selection after click
	   this._textFromValue = {};
	   
	   var that = this;
	   
	   /*
	   * Recursive function to edit a level of menuItems
	   *
	   * args :
	   *   -> conf : an array of menuItems
	   *   -> level : how deeply nested are these menuItems (4 is max)
	   */
	   var levelInit = function (conf,level) {
	      if (level>4) throw new Error("MenuField : too much recursion, menuItems property should be 5 level deep at most.");
	      
	      var item;
	      for (var i=0, length = conf.length; i < length; i++) {
	         item = conf[i];
             if (YAHOO.lang.isUndefined(item.text) && !YAHOO.lang.isUndefined(item.value)) {
	            item.text = item.value;
	         }
	         if (YAHOO.lang.isUndefined(item.value) && !YAHOO.lang.isUndefined(item.text)) {
	            item.value = item.text;
	         }
	        
            // item with submenu
            //   -> explore deeper
	         if (!YAHOO.lang.isUndefined(item.submenu)) {
	            
	            // ensure there is an id on submenu (else submenu is not created)
	            if (YAHOO.lang.isUndefined(item.submenu.id)) {
	               item.submenu.id = YAHOO.util.Dom.generateId();
	            }
	            
	            // continue one level deeper
	            levelInit(item.submenu.itemdata,level+1);
	            
	         // item without submenu
	         //   -> add click listener to this item
	         //   -> pass selected value to the listener (as the 3rd argument)
	         } else {
	            that._textFromValue[item.value] = item.text;
	            item.onclick = {fn:function() {that.onItemClick.apply(that,arguments);},obj:item.value};
	         }
	      }
	   };
	   
	   levelInit(this.options.menuItems,0);
	   
	}
function() {
	   
	   // Keep corresponding text for each value selectable in the menu
	   //   -> will be used to display selection after click
	   this._textFromValue = {};
	   
	   var that = this;
	   
	   /*
	   * Recursive function to edit a level of menuItems
	   *
	   * args :
	   *   -> conf : an array of menuItems
	   *   -> level : how deeply nested are these menuItems (4 is max)
	   */
	   var levelInit = function (conf,level) {
	      if (level>4) throw new Error("MenuField : too much recursion, menuItems property should be 5 level deep at most.");
	      
	      var item;
	      for (var i=0, length = conf.length; i < length; i++) {
	         item = conf[i];
             if (YAHOO.lang.isUndefined(item.text) && !YAHOO.lang.isUndefined(item.value)) {
	            item.text = item.value;
	         }
	         if (YAHOO.lang.isUndefined(item.value) && !YAHOO.lang.isUndefined(item.text)) {
	            item.value = item.text;
	         }
	        
            // item with submenu
            //   -> explore deeper
	         if (!YAHOO.lang.isUndefined(item.submenu)) {
	            
	            // ensure there is an id on submenu (else submenu is not created)
	            if (YAHOO.lang.isUndefined(item.submenu.id)) {
	               item.submenu.id = YAHOO.util.Dom.generateId();
	            }
	            
	            // continue one level deeper
	            levelInit(item.submenu.itemdata,level+1);
	            
	         // item without submenu
	         //   -> add click listener to this item
	         //   -> pass selected value to the listener (as the 3rd argument)
	         } else {
	            that._textFromValue[item.value] = item.text;
	            item.onclick = {fn:function() {that.onItemClick.apply(that,arguments);},obj:item.value};
	         }
	      }
	   };
	   
	   levelInit(this.options.menuItems,0);
	   
	}
function ( ) { // Keep corresponding text for each value selectable in the menu //   -> will be used to display selection after click this . _textFromValue = { } ; var that = this ; /*
	   * Recursive function to edit a level of menuItems
	   *
	   * args :
	   *   -> conf : an array of menuItems
	   *   -> level : how deeply nested are these menuItems (4 is max)
	   */ var levelInit = function ( conf , level ) { if ( level > 4 ) throw new Error ( "MenuField : too much recursion, menuItems property should be 5 level deep at most." ) ; var item ; for ( var i = 0 , length = conf . length ; i < length ; i ++ ) { item = conf [ i ] ; if ( YAHOO . lang . isUndefined ( item . text ) && ! YAHOO . lang . isUndefined ( item . value ) ) { item . text = item . value ; } if ( YAHOO . lang . isUndefined ( item . value ) && ! YAHOO . lang . isUndefined ( item . text ) ) { item . value = item . text ; } // item with submenu //   -> explore deeper if ( ! YAHOO . lang . isUndefined ( item . submenu ) ) { // ensure there is an id on submenu (else submenu is not created) if ( YAHOO . lang . isUndefined ( item . submenu . id ) ) { item . submenu . id = YAHOO . util . Dom . generateId ( ) ; } // continue one level deeper levelInit ( item . submenu . itemdata , level + 1 ) ; // item without submenu //   -> add click listener to this item //   -> pass selected value to the listener (as the 3rd argument) } else { that . _textFromValue [ item . value ] = item . text ; item . onclick = { fn : function ( ) { that . onItemClick . apply ( that , arguments ) ; } , obj : item . value } ; } } } ; levelInit ( this . options . menuItems , 0 ) ; }
Parse menuItems option to add ids, listeners, etc.
Parse menuItems option to add ids listeners etc .