Hi Brian,

   Sounds like you want to use the Persistence API to store this
data.  You should check out this section in the OpenSocial developer's
guide:

http://code.google.com/apis/opensocial/docs/0.7/devguide.html#Persistent

Hope this helps,
~Arne


On Sep 4, 9:54 am, litto dog <[EMAIL PROTECTED]> wrote:
> Hi
>
> Im using the code below, the problem is when i refresh page or
> relogin, the data is also refreshed. i want it to store the data
> permanently unless changed using the text box. is this possible with
> open social?
>
> thanks.
>
> brian
>
> <script type="text/javascript">
>    gadgets.util.registerOnLoadHandler(populateMyAppData);
>    var htmlout = "";
>    var me = null;
>
>    /
> ************************************************************************
>     * Set user data
>     */
>    function populateMyAppData() {
>      var req = opensocial.newDataRequest();
>     var id = document.getElementById("ebayid").value;
>      htmlout += id;
>      req.add(req.newUpdatePersonAppDataRequest("VIEWER", "AppField0",
> id)) + "<br />";
>      req.send(handlePopulateMyAppData, "update_appdata");
>    }
>
>    /
> ************************************************************************
>     * Handle responses from update person app data requests
>     */
>    function handlePopulateMyAppData(data) {
>      if (data.hadError()) {
>        htmlout += data.getError();
>      }
>      requestMyData();
>    }
>
>    /
> ************************************************************************
>     * Fetch app data
>     */
>    function requestMyData() {
>      var req = opensocial.newDataRequest();
>      var fields = ["AppField0"];
>
> req.add(req.newFetchPersonRequest(opensocial.DataRequest.PersonId.VIEWER),
> "viewer");
>      req.add(req.newFetchPersonAppDataRequest("VIEWER", fields),
> "viewer_data");
>      req.send(handleRequestMyData);
>    }
>
>    /
> ************************************************************************
>     * Handle responses from app data requests
>     */
>    function handleRequestMyData(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());
>    }
>
>    /
> ************************************************************************
>    * Operate on user data
>    */
>    function doSomethingWithMyData(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 +=  mydata["AppField0"];
>    }
>
>  </script>
>  <div id="content_div"></div><br/>
> <input id="ebayid" value="" /><input type="submit"
> onclick="populateMyAppData(); go1();" />
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"OpenSocial Application Development" group.
To post to this group, send email to opensocial-api@googlegroups.com
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