Hi All,
I’m new to Axure. I created a drop list with 5 values, with the default of ‘I need…’. Once a user selects a number of lines, 1, 2, 3, 4, 5, I want to retain this selection(the droplist with the selection) in subsequent pages. How do I do that, using droplist and dynamic panel? Or do I use global variables?
If you want it to pass through to other pages, you’ll want to use a global variable. OnSelectionChange of your dropdown, set the variable to the selected option of your dropdown. Then on page load, or window resize, or even onload of the dropdown on subsequent pages, you would set the selected option to the value of the variable. You can use a master for the dropdown so that if you make any changes you only need to change it once - plus you can specify all of the interactions only once. See attached for a quick sample - you’ll see I have all of the interactions within the master - setting the variable and then using the onload to set the selection option to the variable value. dropdownmasterglobal.rp (62.2 KB)
Thanks UXProtoTyper. But how are you connecting the pages? I want to retain the selection of droplist and its selection, so this widget appears on subsequent pages. My page 1 has the droplist. There are no buttons. Once you make a selection, e.g. three, then page 2 is brought up with this widget prepopulated with three.
Also, am I doing things correctly? At what point do I create the global variable, OnLoadVariable, after I have created the droplist? How do I associate the droplist with the global variable, when I create the Case? This is what I have I done:
In the column Click to add actions, I selected= Set Selected/Checked: Selected
In the column Click to add actions, I selected= Variables: Set Variable Value.
In the column Configure actions, I selected my variable, OnLoadVariable.
In the Configure actions section, Set variable to, I selected from the dropdown= value of variable and selected=OnLoadVariable.
Is this correct? Thanks for the help. Just trying to understand how to do this with a droplist.
Your steps aren’t quite right. You’d actually end up setting the variable to the value of itself…
But first - to answer your question about when to create the global variable - global variables exist within the project itself. So you “create” them within your RP file: Project - Global Variables…
By default Axure creates a “OnLoadVariable” variable. You can create your own, too and name them whatever you like. You can also set a default value for the variable. I was being somewhat lazy in my example for you and just used the default variable.
As to setting the value… In this case specifically, you only need to use the “OnSelectionChange” event for the dropdown. Set it so that it sets the value of your variable to the selected value of the checkbox by assigning a local variable (LVAR) to the selected option of the dropdown. Then set the global variable to that value. To see the logic in my example file, either open the “Dropdown” master from the masters panel, or double click on the dropdown on any of the pages. You’ll hopefully see what I’m talking about. Everytime this dropdown value is changed, the global variable will be updated with whatever the selected option of the dropdown is.
Regarding linking between pages…
In my example, the “linking” is done by putting an OnPageLoad event on a master. If you aren’t familiar with masters, it’s basically just a way to reuse the same functionality in multiple occurences. If you look through my sample, you’ll see every page has an instance of the master. The “OnPageLoad” event for the master will fire every time the master is loaded and will set the selected option of the drop down to the value of the global variable.
Hope this makes sense - would be much easier to walk you through this in person!
The pages aren’t connected in any way, that’s sort of the core of how Axure works and why we need to use variables. Think of variables as boxes in a closed room. Each page can enter the room only one at a time and pass messages to the other pages by putting different things in each box. No page has any awareness whatsoever of what the other pages are doing, except by examining the variables in the room after the other page has left.
So when you want information to get from one page to another, you need to leave a message in the box (the variable) using the Set Variable action. Then if you want to the second page to do something based on what the variable’s value is, you create conditional cases that have different actions for different possible values of the variable. This can be done on the OnPageLoad event if you want it to happen right away, or really it could be attached to any event, such as a click on a widget.