It's easy to create userprefs for google gadgets... and if you are
using those gadgets inside iGoogle, the userPrefs make a perfect place
to put setup info... But how does one go about saving those prefs when
the gadget is being run from a page outside of Google?

To provide a little background to think with, I am using this code to
test out the setArray() function. It places the current "username" in
an edit box and when the button next to it is clicked sets the
username to something else... but the next time I come back to it, it
just resets it to the default value, not the new value :

<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="test"
directory_title="test"
description="test"
height="300"
width="300"
scrolling="false"
singleton="false">
<Require feature="tabs"/>
<Require feature="setprefs"/>
</ModulePrefs>
<UserPref name="username"
default_value="wookietim"
display_name="username"
required="true"/>
<UserPref name="selectedTab" datatype="hidden"/>

<Content type="html"><![CDATA[
<script>
var prefs = new _IG_Prefs(__MODULE_ID__);
var url;

function init(){
_gel("username_input").value = prefs.getString("username");
}

function update_username(){
prefs.setArray("username",_gel("username_input").value);
}

_IG_RegisterOnloadHandler(init);

</script>

<input id="username_input"><input type="button"
onclick="update_username()">

]]></Content>
</Module>
--~--~---------~--~----~------------~-------~--~----~
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