cancel
Showing results for 
Search instead for 
Did you mean: 

'remote' not found

spatils
Champ in-the-making
Champ in-the-making
Hello Experts,
I am creating a custom page in Share. I have created my own template. But when I try to access repository using
remote.connect("alfresco"); it is not finding remote object.
How to initialise remote object?
Please find sample js code below

(function()
{
   /*
    * sample constant value
    * @property MY_CONSTANT
    * @type int
    * @private
    */
   var MY_CONSTANT = 101;

   /**
    * Alfresco.SampleTemplate constructor.
    * @return {Alfresco.SampleTemplate} the new instance
    */
   Alfresco.UserHomePage = function UserHomePage_constructor()
   {
      /*
       * Request YUI Components
       * TODO: Update component list for specific requirements.
       * Note: If no YUI dependency, replace component list with empty array [].
      */
      Alfresco.util.YUILoaderHelper.require(["button"], this.onComponentsLoaded, this);

      return this;
   };

   Alfresco.UserHomePage.prototype =
   {
      /**
       * Fired by YUILoaderHelper when required component script files have
       * been loaded into the browser.
       * @method  onComponentsLoaded
       */
      onComponentsLoaded: function SampleTemplate_onComponentsLoaded()
      {
         /* Register the onReady callback when the DOM has been loaded */
         YAHOO.util.Event.onDOMReady(this.onReady, this, true);
      },
     
     
      /**
       * Fired by YUI when template's DOM has been constructed and ready for use.
       * @method  onReady
       */
      onReady: function UserHomePage_onReady()
      {
         /* TODO: Initialisation code, e.g. create YUI components. */
         function callokclickf(e){
            alert("Inside callokclickf");
          [i][b]  var connector = remote.connect("alfresco");[/b][/i]
        };
         YAHOO.util.Event.addListener("ok1","click",callokclickf);
      },
      _msg: function DLTB__msg(messageId)
      {
      return Alfresco.util.message.call(this, messageId, "Alfresco.UserHomePage", Array.prototype.slice.call(arguments).slice(1));
      }
   };
})();

/* Instantiate the template object as soon as it has been declared */
new Alfresco.UserHomePage();
2 REPLIES 2

mikeh
Star Contributor
Star Contributor
The "remote" object is part of the web framework API, not a browser extension. In other words, it's a server-side API, not a client-side one.

To make a remote (AJAX) call from client-side JavaScript, you can use the YUI Connection classes, or the various wrappers found in alfresco.js for Share.

Thanks,
Mike

spatils
Champ in-the-making
Champ in-the-making
Mike,
Thanks a lot for the replay.

I was going through code of different share components. And I found this API used in different js script.
I was doing guess work here.

Which API should I use

2 Alfresco.util.Ajax.jsonRequest
Or
3 YAHOO.util.Connect.asyncRequest("POST", url, "", dataStr);

My objective is to create new users after user enters firstname, last name ,email and password in a form.

regards
Sameer