Defining User Preferences
You may need to save user preference variables persistently within an
application’s OpenSocial gadget. This is where the UserPref element comes into play. It allows you to configure which
variables you would like to store for a user. These configuration
variables, along with JavaScript features we will talk about in later
sections, provide simple key/value storage without requiring you to set up
a database.
UserPref contains a number of
configurable attributes, listed in Table 3-7.
Table 3-7. UserPref attributes
Attribute | Description |
|---|---|
| An optional string
that denotes the date type present within the user
preference variable. The value may be |
| An optional string that stores a default value for a user preference in the event that the user does not specify a variable configuration. |
| An optional string that represents the user preference during editing. This value must be unique. |
| The name of the user preference. This value is required and must be a unique value. |
| An optional Boolean value ( |
| If a |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access