Dynamic Conditional Filtering of a Repeater
ATTENTION: THIS IS OUR OLD SITE. TO SEE OUR NEW WEBSITE, CLICK HERE.
It is often helpful to break up large lists into conditional lists when requiring users to choose from options in a dropdown menu. Learn how to dynamically filter a repeater first by a high level category (such as region) and then by a low level category (such as town or location) underlying the high level category already chosen.
This example assumes you are already familiar with adding repeaters to a page. The screenshot below shows a conditional dropdown for filtering a repeater on news articles by region and sub-region (where sub-region is conditioned on region). The region dropdown is enabled on page load while the sub-region is disabled on page load. Once the region dropdown has been selected (e.g. Canterbury in the screenshot), then other options in the sub-region are made available. The options for each dropdown will be defined using code. Give each dropdown input an alias (iptRegion and iptLocation in this example). Add an onChange event listener to each button.
Please login or sign-up (it's free!) to view our code. Refresh the page if already logged in.
Disclaimer: To the best of our knowledge, this code works for its stipulated purpose. If you find an error in our code, or know of a better way to achieve the same result - please contact us! We will help where we can, however please be aware that the code is provided 'as is' and without a promise of support in using or implementing it.