Need a bulleted/numbered list to update dynamically based on user input

Nov 04, 2014

Hey guys,

 

I'm trying to create a "history" page that updates after a user has performed a various action, where they can visit at anytime to review what they have done

 

For example:

If a user goes to the history page before doing anything it will be blank.

 

If a user then goes to a page asking them to pick 1, 2, or 3. selects 3 and then returns to the history page they would see:

 

- User has selected 3

 

If a user goes back to the selection page and picks 2, the history page would then show:

 

- User has selected 3

 

- User has selected 2

 

 

 

This would continue to add a new entry every time a user selects a number.

 

I know how to display variables in a text box using the %'s but I don't know how to add multiple bullet points dynamically. Any help would be appreciated.

4 Replies
Julie Stelter

Hi Stephen, Interesting problem. So what if you kept adding the text you want to appear on the history page to the same variable. This variable follows the user to every screen and is updated after the action is completed. The history page would then show the variable's value. I don't know if you can get bullets inserted or paragraph breaks so this may not be the answer.

Would this solution work for you? Create a list of all of the bullet points on the history page. If "user has selected 3" is true, for example, the state of bullet 3 would be in a darker color while the other bullets would be grayed out. The next time the user visits, perhaps "user selected 5" is true. Thus both 3 and 5 would be darker color.

Cheers, Julie

 

 

Stephen Gerbrandt

Thanks for the reply,

Your first suggestion is worth a shot. I may be able to get away with one item per line if I limit the width of the text box. Unfortunately your second suggestion wouldn't work for our design since it is intended that the user could do anything in any order, even pick the same option multiple times.

It looks like I could use a javascript function to get at and format the data in the variable, and then return it, which may be the route I need to go in to solve this issue.

 

Thanks again for the help.

Stephen Gerbrandt

Update: adding a javascript function to the elements that need to update the history page got me the result I was hoping for. I can even add in the bullet points if needed using the unicode value for it \u2022

var player = GetPlayer();
var firstValue = player.GetVar("Val1");
var secondValue = player.GetVar("Val2");
var summary = player.GetVar("ActionSummary");

if (summary !== "") {
    summary += "\n"
}
    summary += "\u2022    " +"User set first value to: " + firstValue + " and second value to: " + secondValue;

player.SetVar("ActionSummary", summary);

This discussion is closed. You can start a new discussion or contact Articulate Support.