I'm not sure, if
would work together with &resources to filter only resources which are in the given parents and in the resources-list.
May be, getResources will show all resources, which are in the given parents and all which are in the resources-list.
perhaps you can try
or for more parents:
&where=`{"parent:IN":"X,Y,Z"}`
[ed. note: Bruno17 last edited this post 14 years, 10 months ago.]
Thanks Bruno. One last question, is it possible to make the snippet only execute when the form is submitted? Instead of the snippet executing when the page loads?
Hi, I was trying to achieve the same thing, could you summarize how you did this?
I would like to create a search using select inputs rather than typing a search word into a text input.
If there were 3 select (dropdown) inputs, the search would only bring back results that contained ALL 3 selected inputs.
Simplesearch using select inputs would't work as this would bring back results with ANY of the 3 selected inputs.
Is there a way of doing this with getResources?
getResources could do such a search, but it wouldn't know which input options were selected. You'd want to put these in the &where property of getResources.
I'd suggest writing a custom search snippet that gets the selected inputs from the $_POST array. If you need the bells and whistles of getResources, you can call it in your snippet with $modx->runSnippet('getResources', $fields), where $fields is an associative array containing the properties you'd normally put in the getResources tag.
Another way to go would be to
create the where array in a snippet called getWhere and do this:
[[!getResources? &where=`[[!getWhere]]` (etc.)]]