Droplist selection, go to new page and set selected


#1

Hi guys.
Working on a banking app, and trying to select an option from a droplist, open a new page, and have the droplist show the option that was selected on the new page.

Rather than setting the default value on droplist, on the new page…is there an easier way to do it?
i’ve tried with setting global variables, selected option, and set selected on new page…to no avail!
Help!

Thank you in advance


#2

in general, if you want to make changes on Page 2 based on interactions from Page 1, you will need to use a global variable. Or, you could fake the page change by using a different state in a dynamic panel. …But let’s keep with your original idea of changing actual pages. So, on Page 1, in your droplist’s Selection Changed event, set a global variable, e.g., “Set OnLoadVariable to selected option of This” and then “Open Page 2 in Current Window”. Then on Page 2, in either the Page Loaded event or the droplist widget’s Loaded event, add an action to “Set Selected List Option to value of OnLoadVariable”.

If this doesn’t make sense, it would be easiest if you can upload your .rp file.


#3

That was my understanding of the logic as well.
-setting the selection, global variable, then on page x, on page loaded event, chanign the status of the droplist…ugh. here is the rp file.

I was trying to save time with a master drop list widget.

thank you in advance
jsDL_testing.rp (4.2 MB)


#4

OK. Not clear what you might of tried and why it didn’t work, but since you’ve made the droplist a master, it would be nice if it could take care of itself regardless of the page instead of trying to set it on each page’s Page Loaded event. It looks like you’ve set a kind of hash with the last three digits of the account appearing in the page name, but not always, so you may need to manually add a case for each page anyway.

Essentially, you can create a set of conditional cases for the droplist’s Loaded event to correspond to those in the Selection Changed event, but reverse the logic: test the global variable “ACC” and set the selected list option accordingly. Come to think of it, you could just test the name of the page using the built-in [[PageName]] variable. This would actually be more robust because any of your pages might get loaded by some means other than making a selection in this droplist, no? For example, all of the “usd” pages should show the correct account in the droplist too, right?

When I first applied this logic it created a never ending loop because when a user changes the droplist selection it triggers a page to be loaded, then the selection gets changed when that page loads which triggers it to load the (same) page again. So, I repurposed the global variable, “ACC” to track whether the selection change was manual (from a user action; change the page) or automatic (from a page load; don’t change the page, just the droplist.)

So, in the updated file below, if you look at your droplist master, the Loaded event tests the [[PageName]], sets “ACC” to value of “loaded”, then sets the list option. The Selection Changed event has a “Case 0” which clears ACC if it equals “loaded”. The rest of the Cases have an “ELSE IF” so they are only handled after the page loads–and ACC gets set to blank–so thus only triggered when the droplist is manually changed.

DL_testing.rp (4.2 MB)