![]() | clearString neatComponents
|
| |
Using cookies |
![]() | ||
![]() | Techniques & KB Articles | ![]() |
Using cookies |
![]() | ![]() |
In addition to the built-in cookies used by the system, you can store any number of extra cookie to persist user choices.
Whilst this feature does not require any technical knowledge about cookies themselves, you do need to be aware when cookies are stored, and when they are acted upon:
Imagine a situation where a site needs to remember a user’s language preference.
The choice: This is a normal embedded query, with a set of links to the confirmation page. The only requirement is that the links can a parameter for the choice to be stored: so in the language example, this would be the Record Id of the language Table. (Example note: You would need to manually create a Table for the language choices – this is not an inherent system table)
The confirmation page needs to contain a query embed, that includes the Record ID of the language table, and has this set as a criteria.
So far, this is no different from any normal choice-confirmation set of queries on two pages.
However we now want the confirmation page to set the cookie. To do this, in the query embed on the confirmation page, against the field with the criteria, check the ‘Save as cookie’ checkbox.
That saves the cookie on the client, and subsequent page requests will have it available to them.
On the subsequent pages, you embed a query on the page, and give it a criteria on the same field. However instead of setting it to use [Page parameters], select [Page parameters, cookies], and it will respect the cookie if there isn’t a page parameter specified.
|