Currently I have a basic form where the user selects a City from a dropdown. After they’ve made their selection, they click on Submit, the page refreshes or whatever. And then this options act as filters pretty much to then show a list of “Web App” items. (on another note, is it possible for the page to refresh onpage? e.g. some sort of ajax loading or inline loading so the page doesn’t entirely ‘refresh’ with liquid?)
My liquid is currently:
{% component source: “McDonalds”, layout: “”, collectionVariable: “mcdonalds”, type: “module” %}
{% for item in mcdonalds.items %}
{% if item.City == ‘Melbourne’ %}
{{item[‘Suburb’]}}
{% endif %}
{% endfor %}
Is there anyway to get their selection into the line so that it shows the correct list of web app items?
{% if item.City == ‘their selection’ %}
In this example you can see that the tag, category, date links just add the relevant info to the url and then the section that starts with ``` {% if request.request_url.params.cat %}
does the filtering.
Hi @Khy
As per the comments above, there are several ways to go about this depending on your setup. So I just have some questions:
Is your form one that actually needs to be submitted (ie: add a contact to the CRM, send an autoresponders and/or workflow notification) or is it just a means for displaying the “WebApp” items?
How many WebApp items in total are there likely to be?
Thank you so much guys this is extremely helpful to parse data using the url.
My top preference would be to have the page reload and display the results based on my selection without the page refreshing itself. (so not using the url passing solution) is there such a way to do this with liquid? or jquery?
thanks @Adam.Wilson it is really just a means to display the web app items. no CRM interaction. and there’s literally hundreds of “web app items”.
For the page not to reload AND have the use of Liquid you’d need to use AJAX to fetch the new data from a page where your Liquid conditions are set up (again, passing the required parameters in the AJAX URL).
If you don’t want to play with AJAX, it might be feasible to load ALL of your items on the page initially (hidden) then use javascript/jQuery to filter the items you need based on user interaction.
You could also consider using the Custom Module search function (as that sounds almost like what you are doing) but process the results via AJAX. I believe this is possible. @A3CS might have a snippet for AJAX search filtering?