public/javascripts/inputex/js/rpc/inputex-rpc.js
function(method, formOpts, callback) {
   
      var options = null;
      if(YAHOO.lang.isObject(formOpts) && YAHOO.lang.isArray(formOpts.fields) ) {
         options = formOpts;
      }
      // create the form directly from the method params
      else {
         options = inputEx.RPC.formForMethod(method);
      	// Add user options from formOpts
         YAHOO.lang.augmentObject(options, formOpts, true);
      }
   
      // Add buttons to launch the service
      options.type = "form";
      if(!options.buttons) {
         options.buttons = [
            {type: 'submit', value: method.name, onClick: function(e) {
               YAHOO.util.Event.stopEvent(e);
               form.showMask();
               method(form.getValue(), {
                  success: function(results) {
                     form.hideMask();
                     if(YAHOO.lang.isObject(callback) && YAHOO.lang.isFunction(callback.success)) {
               		   callback.success.call(callback.scope || this, results);
               		}
                  },
                  failure: function() {
                     form.hideMask();
                  }
               });
					return false; // do NOT send the browser submit event
            }}
         ];
      }
   
      var form = inputEx(options);
   
      return form;
   }
function(method, formOpts, callback) {
   
      var options = null;
      if(YAHOO.lang.isObject(formOpts) && YAHOO.lang.isArray(formOpts.fields) ) {
         options = formOpts;
      }
      // create the form directly from the method params
      else {
         options = inputEx.RPC.formForMethod(method);
      	// Add user options from formOpts
         YAHOO.lang.augmentObject(options, formOpts, true);
      }
   
      // Add buttons to launch the service
      options.type = "form";
      if(!options.buttons) {
         options.buttons = [
            {type: 'submit', value: method.name, onClick: function(e) {
               YAHOO.util.Event.stopEvent(e);
               form.showMask();
               method(form.getValue(), {
                  success: function(results) {
                     form.hideMask();
                     if(YAHOO.lang.isObject(callback) && YAHOO.lang.isFunction(callback.success)) {
               		   callback.success.call(callback.scope || this, results);
               		}
                  },
                  failure: function() {
                     form.hideMask();
                  }
               });
					return false; // do NOT send the browser submit event
            }}
         ];
      }
   
      var form = inputEx(options);
   
      return form;
   }
function ( method , formOpts , callback ) { var options = null ; if ( YAHOO . lang . isObject ( formOpts ) && YAHOO . lang . isArray ( formOpts . fields ) ) { options = formOpts ; } // create the form directly from the method params else { options = inputEx . RPC . formForMethod ( method ) ; // Add user options from formOpts YAHOO . lang . augmentObject ( options , formOpts , true ) ; } // Add buttons to launch the service options . type = "form" ; if ( ! options . buttons ) { options . buttons = [ { type : 'submit' , value : method . name , onClick : function ( e ) { YAHOO . util . Event . stopEvent ( e ) ; form . showMask ( ) ; method ( form . getValue ( ) , { success : function ( results ) { form . hideMask ( ) ; if ( YAHOO . lang . isObject ( callback ) && YAHOO . lang . isFunction ( callback . success ) ) { callback . success . call ( callback . scope || this , results ) ; } } , failure : function ( ) { form . hideMask ( ) ; } } ) ; return false ; // do NOT send the browser submit event } } ] ; } var form = inputEx ( options ) ; return form ; }
Build a form to run a service !
@param {function} method A method created through inputEx.RPC.Service
@param {Object} formOpts
Build a form to run a service !