AnsweredAssumed Answered

dashlet access repository with buttons to webscripts?

Question asked by targa2000 on Mar 14, 2010
I have been able to access repository webscripts from share dashlets with calls to :

var connector = remote.connect("alfresco");
var data = connector.get("/somewebscript");

I created a dashlet with buttons that uses javascript within the dashlet to try to call repository
webscripts, but it doesn't seem to recognize remote.connect("alfresco").  How can I implement buttons on a dashlet that calls various webscripts on the repository?

<div class="dashlet">
   <div class="title">Forms dashlet</div>
   <div class="body">
<script type="text/javascript">

function callGet(TestVar) {
   alert ("inside callGet");
   // call over to Alfresco and fetch some content
   var connector = remote.connect("alfresco");
   alert ("after remote.connect");
   var data = connector.get("/somewebscript");
   alert("after connector get");
   alert("data:" + data);   
   // create json object from data
   var json = eval('(' + data + ')');


function readText (form) {
    TestVar =form.inputbox.value;
    alert ("You typed: " +TestVar);
    //var success = callRep(TestVar);
    var success = callGet(TestVar);
    alert ("You typed: " + TestVar + ", success:" + success);

function writeText (form) {
    form.inputbox.value = "Have a nice day!"
Enter something in the box: <BR>
<INPUT TYPE="text" NAME="inputbox" VALUE=""><P>
<INPUT TYPE="button" NAME="button1" Value="Read" onClick="readText(this.form)">
<INPUT TYPE="button" NAME="button2" Value="Write" onClick="writeText(this.form)">