I am simply trying to read a user's boolean preference in a Google Gadget, but it seems that the preference is never getting saved at all, and I only ever get whatever the default_value is. I've broken this down into a very simple test case. Here is my test gadget spec:
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="Gadget to test bool">
</ModulePrefs>
<UserPref name="testpref" display_name="Test Boolean Preference" default_value="true" datatype="bool" />
<Content type="html">
<![CDATA[
<script type="text/javascript">
var prefs = new gadgets.Prefs();
alert(prefs.getBool('testpref'));
</script>
]]>
</Content>
</Module>
What I expect to see is an alert with true
or false
in it for whatever the user has chosen in the preferences dialog. However, the user's preferences are completely ignored, not saved, and even my default value isn't shown in the preferences. When I specify true for the default value, the preference checkbox remains unchecked.
What am I missing?
Edit: I am trying to get this working on a Google Apps Google Sites Start Page.