Jump to content

Recommended Posts

Posted

In reference to http://processwire.com/api/fieldtypes/repeaters/ is it possible to say 'where all repeater items' rather than 'where at least one repeater item' inside your selector?

What I have is a repeater with a checkbox. I want to find pages where all repeater items on the page are checked or unchecked. If I do this:

$pages->find("my_repeater.my_checkbox>1");

I get pages where at least one repeater item has the checkbox ticked, but what I want is pages where the checkbox is ticked in all of the repeaters.

Posted
$pages->find("!my_repeater.my_checkbox<1");

This should work. It means find all pages where NOT at least one repeater does have an unchecked checkbox.

  • Like 4
Posted
1 hour ago, LostKobrakai said:

$pages->find("!my_repeater.my_checkbox<1");

This should work. It means find all pages where NOT at least one repeater does have an unchecked checkbox.

And you'll probably want to add something to make sure you only match pages containing my_repeater:

$pages->find("my_repeater.count>0, !my_repeater.my_checkbox<1");

 

  • Like 3

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...