How to re-show information that users have told you: Difference between revisions

From Lifeguide Wiki
Jump to navigation Jump to search
No edit summary
 
(27 intermediate revisions by the same user not shown)
Line 1: Line 1:
An example of this would be to re-show a goal that an end-user has entered in a previous session so that they can say whether they achieved it.


=Free-entry text boxes=
== Showing users' responses on the same page ==
First you will need to create a text box on a page and give it a unique name. Then in the '''intervention.lgil''' file write the logic to save the goal that end-users will enter:


<code> show page1
The <code>saveandload</code> key command can be used after a page that includes interactions so that if an end-user moves away from that page and then comes back to it, the page will automatically show them what they entered the last time they were on that page. This line of logic would be written as:


savevalue(username, "goal1", page1.interaction1) </code>
<code> show page1</code>


The logic above is saving interaction1 on page1 as a variable called '''goal1'''
<code>saveandload page1 for username </code>


To show the goal on a page in a different session, you will need to create a new page, insert a text box and set the text as a variable.
Any interaction on page1 would then be saved and loaded each time the end-user comes back to that page.
'''[[Click here for setting text as a variable|How to set text as a variable]]'''
To set text as a variable:
 
1) Click on '''Text box'''
 
2) In the white box under '''Textbox Properties''', delete '''edit me''' and enter a unique name (e.g. s1goal)
 
3) Highlight the unique name you have just entered
 
4) Click on '''Set Selected Text As...'''
 
5) Select '''Set as variable'''
 
6) The text in your text box should now have angular brackets (<>) around your variable name
 
In the '''intervention.lgil''' file, you will need the following logic:
 
<code>show page2
set page10.s1goalto loadvalue(username,"goal1")</code>
 
The above logic will load the goal that was saved as '''goal1''' previously in the logic, into the text box with the variable name '''s1goal''' on page10.
 
If you are displaying this goal with other goals as feedback, please note there are a few extra steps:
1) You will need to use a container on page10. Click here for information on how to use containers on pages.
2) The text that you have just set as a variable will need to be set to '''feedback'''. First, click on the text box. Under '''Textbox properties''' scroll down to the end and select '''Feedback'''. Enter a unique name (e.g. goal_one)
3) You will need an extra line of logic telling the goal to show only if a goal has been previously entered by an end-user:
 
<code>show page10.goal_one if (not(isempty (loadvalue(username,"goal1")))) </code>
 
This logic will show the feedback item called '''goal_one''' on '''page10''' if '''goal1''' is not empty (i.e. if an end-user entered a goal which was saved as goal1)

Latest revision as of 13:58, 19 August 2015

Showing users' responses on the same page

The saveandload key command can be used after a page that includes interactions so that if an end-user moves away from that page and then comes back to it, the page will automatically show them what they entered the last time they were on that page. This line of logic would be written as:

show page1

saveandload page1 for username

Any interaction on page1 would then be saved and loaded each time the end-user comes back to that page.