Jump to content

Search selectors and empty repetear fields


lele_ballack
 Share

Recommended Posts

There is something about a search form that I'm unable to solve. 

My search form has a text input that searches through fields of a specific template:

// keyword input
if(isset($input->get->q)) {
  $keyword = $sanitizer->text($input->get('q'));
  $selector .= "title|Abbreviazione|Sottotitolo|Titolo_Testo.Titolo|Titolo_Testo.Testo~%=$keyword, ";
  $input->whitelist("q", $keyword);
}

In this template, there fields are: title, Abbreviazione and Sottotitolo (text fields) and Titolo_Testo (repeater made of text fields Titolo and Testo).

When I search any word, it returns the matching pages, but when I reset my form to (or search) an empty value, it only finds pages where the repeater Titolo_Testo is set and filled. 

How can I instruct it to search for repeaters only if they are set and get all pages results on an empty value search? 

Or else, is there a way to detect an empty search value as isset still returns true?

I'm using PW 3.0.165.

Thanks a lot!

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...