Jump to content


How to find elements with empty field

  • Please log in to reply
23 replies to this topic

#21 Soma


    Hero Member

  • Moderators
  • 6,348 posts
  • 5608

  • LocationSH, Switzerland

Posted 14 February 2012 - 04:32 PM

code also checked, even in new file.

Only new file and copied over? Have you tried rewrite the line of code that causes the issue from scratch? You laugh, but I got an situation where it just wouldn't work with a selector, turned out there was a hidden char not visible at all even in "showinvisible" mode.
@somartist | modules created | support me, flattr my work flattr.com

#22 elmr


    Jr. Member

  • Members
  • PipPip
  • 10 posts
  • 0

Posted 14 February 2012 - 05:08 PM

Soma I've rewritten the code and it was the same but...another strange thing.

I thought it may be connected with pager so I removed rendering pager, disabled page numbers for this particular page and changed code to :
$pages->find('template=movie, limit=10')->not("youtube_id=''");
But it didn't show any results.

So I removed limit=10 and then it worked properly. Movies with empty fields didn't show up. But still I didn't have pager functionality, so I brought back rendering pager, enabled page numbers and added limit=10 again... and now it's working right... with the code and the same settings with which it was not working few minutes ago.

It's really strange and I have no idea what can be the reason of this behaviour :-/

#23 ryan



  • Administrators
  • 9,977 posts
  • 10729

  • LocationAtlanta, GA

Posted 15 February 2012 - 04:08 PM

It's really strange and I have no idea what can be the reason of this behaviour

Any time when I've had behavior like this it's because I was using either template caching or markup caching, and didn't realize I was seeing cached versions. So make sure you are logged in when changing around stuff (or that you aren't using caching).

We've also noticed that TinyMCE can store characters in text fields that aren't otherwise visible (even looking directly in the database). I had to go in with a hex editor before I could see the UTF-8 non-breaking space TinyMCE had inserted. So if your text field has been used with TinyMCE at some point, that's something to consider.

Table repair is also something to consider when you see strange results. That will cause MySQL to rebuild the index for the table. But I wouldn't expect this to be necessary unless someone has changed a MySQL setting (like ft_min_word_len) and not rebuilt all the database indexes.

#24 owzim


    Sr. Member

  • PW-Moderators
  • 415 posts
  • 510

  • LocationBerlin, Germany

Posted 01 August 2013 - 03:42 PM

I was just encountering the same problem but with another root of evil =)
I used it on a date field like: 


for finding pages with non empty date_fields, but it turns out, the selector engine is using the unformatted value of the fields (what else, silly me), in this case the value of an unformatted date_field is 0 and not "" (empty) which is what it looks like on the admin page.



works just fine.

@owzim | ch.rauni.me | processwire-recipes.com - Tasty bits of ProcessWire wisdom

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users