First, change the line that reads:

req.send(handleRequestMyData);
to
req.send(handleRequestTarefa);

Also change

doSomethingWithMyData(mydata.getData());
to
doSomethingWithTarefa(mydata.getData());

Your application also can't set data for the OWNER.  You should change

req.add(req.newUpdatePersonAppDataRequest("OWNER", "Tarefas",
tarefa));
to
req.add(req.newUpdatePersonAppDataRequest("VIEWER", "Tarefas",
tarefa));

On orkut, this call will only be successful if the viewer has the
application installed, so you may want to check for that condition
first.  You should check out this article for more information about
how these calls work: 
http://code.google.com/apis/opensocial/articles/persistence.html

Hope this helps,
~Arne


On Jun 14, 10:38 am, Vinicius <[EMAIL PROTECTED]> wrote:
> my code return next error: "Missing or malformed url parameter
> Error 400", i please of help !!!
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <Module>
>   <ModulePrefs title="Tarefas My Teste" >
>     <Require feature="opensocial-0.7"/>
>   </ModulePrefs>
>   <Content type="html">
>   <![CDATA[
>
>   <script type="text/javascript">
>    var htmlout = "";
>    var me = null;
>
>    function AddTarefa() {
>      var req = opensocial.newDataRequest();
>      var tarefa = document.getElementById('id_tarefa').value;
>
>      req.add(req.newUpdatePersonAppDataRequest("OWNER", "Tarefas",
> tarefa));
>      req.send(requestTarefa);
>    }
>
>    function requestTarefa() {
>      var req = opensocial.newDataRequest();
>      var fields = [ "Tarefas" ];
>
> req.add(req.newFetchPersonRequest(opensocial.DataRequest.PersonId.OWNER),
> "viewer");
>      req.add(req.newFetchPersonAppDataRequest("OWNER", fields),
> "viewer_data");
>      req.send(handleRequestMyData);
>    }
>
>    function handleRequestTarefa(data) {
>      var mydata = data.get("viewer_data");
>      var viewer = data.get("viewer");
>      me = viewer.getData();
>
>      if (mydata.hadError()) {
>        htmlout += data.getError();
>        return;
>      }
>      // Do something with the returned data - note the getData call
>      doSomethingWithMyData(mydata.getData());
>    }
>
>    function doSomethingWithTarefa(data) {
>      //Data is indexed by user id, and represents an object where
> keys
>      //correspond with the app data fields.
>      var mydata = data[me.getId()];
>      var div = document.getElementById('content_div');
>      htmlout += "Tarefa Adicionada: " + mydata["Tarefas"] + "<br />";
>      div.innerHTML = htmlout;
>    }
>
>  </script>
>
> <h1>Tarefas do Dia</h1>
>
> <br>
>
> <hr>
>
> <form action="#" name="myform" onSubmit="AddTarefa()">
>
> Tarefa:<input id="id_tarefa" type="text" value="" />
>
> <input type="submit" value="add" name="name_s" />
>
> </form>
>
> <hr>
>
>  <div id="content_div"></div>
>
>   ]]>
>   </Content>
> </Module>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"OpenSocial Application Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/opensocial-api?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to