Note to mods  - please delete my previous post which I inadvertently
submitted before I had completed it.

Hi

Is there any way of saving a json object inside an array.  I have
build a gadget with two input fields of name and comments.  I want to
save these.  My array fields is defined as a userpref field:

<UserPref name="myComments" datatype="hidden" default_value="" ></
UserPref>

I want this myComments field to store an array of json objects, with
the json object being of the format:

commentJSON = {'name': myname, 'comment': comment};

The work of extracting data and saving it to the array is done in this
function:

    function saveComment(form) {
       comment = form.comment.value;
      myname = form.myname.value;
      commentJSON = {'name': myname, 'comment': comment};
      comments = prefs.getArray("myComments");
      comments.push(commentJSON);
     prefs.setArray("myComments", comments);
     writeHTML(comments);
     }

Unfortunately if error on the prefs.setArray function with a no
element found error.  Is there any way round this problem to save an
array of json objects.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"iGoogle Developer Forum" 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/Google-Gadgets-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to