Dear all,

we are creating a Proof of Concept Gadget for our customer.
We want to be able to store and retrieve user preferences for this gadget,
actually the same as was discusses in the thread "Data Persistence of
Google Gadgets (e.g. TODO List)". However I found no clear answer in that
thread.

So let me try to explain what is the issue here. The gadget we created has
a UserPref defined and requires the feature setprefs, here is a snippet:

<Module>
    <ModulePrefs title="hello world example">
        <Require feature="setprefs"/>
    </ModulePrefs>
    <UserPref name="picture_format" display_name="Picture Format"
              datatype="hidden" required="true" default_value="CIRCLE"/>

We create a prefs instance and we try to set the pref.

       <script type="text/javascript">

           var prefs = new gadgets.Prefs(1000);
           var pictureFormat = prefs.getString("picture_format");

           var div = document.getElementById("pfDisplay");
           div.innerHTML=pictureFormat;

           $("input[name='radio']").click(function(){
                var value=$('input[name=radio]:checked').val();

                console.log(value);
                div.innerHTML=value;

                prefs.set("picture_format", value);

           });
        </script>

1. First of when we change the value of the radio button control  the
prefs.set call ends with an error that is not clear to me:

No relay set (used as window.postMessage targetOrigin), cannot send
cross-domain message

Googling around tells me that I should set an identifier somewhere, but I
do not have a clue what identifier that would be. This is because I call
the gadget as follows:

http://localhost:8080/gadgets/ifr?url=http://localhost:8080/gadget.xml&debug=1&up_picture_format=SQUARE

(I found this link that is giving me the impression I am missing some
things on the gadget :
http://comments.gmane.org/gmane.comp.web.shindig.devel/2488)

2. Second, if this is the good call (prefs.set(x,y)), how should we make
sure the picture format parameter ends up in our database? and how do we
connect it to the same user? With this I mean, that while at the moment I
have no authenticated user, I will have somewhere in my session a UUID of
the user with which I want to store his/her prefs.

Any help will be very much appreciated.

kind regards,

Henk de Vries
Consultant
Hinttech

Reply via email to