How to create a drop down list with a counter


#1

I designed a drop-down list with a counter and having trouble making a default state when items are not selected. It should say ‘Refine Results’ but can’t seem to “hide” the number counter.

Also, is there a way to add a text next to the number? 1, 2,3 to 1 selected, 2 selected, 3 selected, etc…counter-menu.rp (117.5 KB)


#2

The default state (when the page is loaded) does say “Refine Results” so you must mean “returning to that default state” after items have been selected and then all unselected. So, you have two states in each item’s “FavItem5” dynamic panel, each with a hotspot that changes the text value of FavNav (displayed as a number.) The “Gray” state selects the item and increments the text value, and the “Orange” state deselects the item and decrements the text value. You need to add some logic in the “Orange” state to test for the case if FavNav is less than or equal to 1 (before you decrement it) and if true, set the text value to “Refine Results”.

Yes, you can do this by adding text outside of the “variable brackets”–the double-square brackets. So, instead of Set Text of FavNav to "[[LVAR1 + 1]]" you would have, Set Text of FavNav to "[[LVAR1 + 1]] selected" However, this means you need to change how you increment and decrement that value because the text value (“1 selected”) would no longer equate to a number. A simple way to do this is to have a global variable, say “FilterCount” (or “FavNumber” which seems to be a global variable “lost” in your .rp file?) Use this global variable to track the numerical value–the count of how many items are selected–and then set the text of FavNav to "[[FilterCount]] selected".

I’ve updated this in Page 2 of this updated .rp file:
counter-menu.rp (211.8 KB)


#3

Thank you! This was what I was looking for.


closed #4

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.