lele_ballack Posted September 17, 2020 Share Posted September 17, 2020 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 More sharing options...
Ivan Gretsky Posted September 17, 2020 Share Posted September 17, 2020 3 hours ago, lele_ballack said: Or else, is there a way to detect an empty search value as isset still returns true? Maybe something as simple as this will do? if(isset($input->get->q) && !empty($input->get->q)) { ... 1 Link to comment Share on other sites More sharing options...
lele_ballack Posted September 18, 2020 Author Share Posted September 18, 2020 Thanks a lot @Ivan Gretsky! You're right, it was way easier than I thought! It worked like a charm! ? 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now