close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Issues with New (undocumented) Search Behaviour

Thread began 9/05/2016 10:20 am by Dave Buchholz | Last modified 3/13/2017 1:48 pm by Ray Borduin | 831 views | 11 replies |

Dave BuchholzBeta Tester

Issues with New (undocumented) Search Behaviour

Ray,

On the page we worked on in the last Premier Support Ticket I am testing the checkbox facility again but it is not working as I expect.

On the search page I have a series of check boxes like so:
<label>
<input type="checkbox" class="filterCheck brandsSubmit amana" name="brands[]" value="9">
Amana</label><br>
<label>
<input type="checkbox" class="filterCheck brandsSubmit american-range" name="brands[]" value="534">
American Range</label><br>
<label>
<input type="checkbox" class="filterCheck brandsSubmit bello" name="brands[]" value="22">
Bell'O</label><br>
<label>
<input type="checkbox" class="filterCheck brandsSubmit bosch" name="brands[]" value="25">
Bosch</label><br>
<label>
etc. etc.

and my search is set up like so:
$search_rsDataSet->clearSearch();
$search_rsDataSet->setSearch(array("type"=>"Checkbox", "comparison"=>"=", "join"=>"AND"), array("pkBrand"), "i", isset($_POST["brands"])?$_POST["brands"]:'');

I can see that the values are being passed through when I do:
print '<pre>';
print_r($_POST['brands']);
print '</pre>';

I get:
Array
(
[0] => 27
[1] => 42
[2] => 428
)

But the recordset is not filtered, why is that ?

URL's etc in PM

Thanks.

Sign in to reply to this post

Ray BorduinWebAssist

When using "type"=>"Checkbox", you don't have to pass the full post, just the field name like:
$search_rsDataSet->setSearch(array("type"=>"Checkbox", "comparison"=>"=", "join"=>"AND"), array("pkBrand"), "i", "brands");

Sign in to reply to this post

Dave BuchholzBeta Tester

Thanks Ray, that works however there is a warning created from rsobj.php, see PM.

Next question, say I wanted to pass a PHP Array into the search for example $i8_current_comparisons, how would I do that ?

Sign in to reply to this post

HBak82161085

I've corrected those lines and uploaded the fix.

If you use "type"->"value" you can pass an array directly.

Sign in to reply to this post

Dave BuchholzBeta Tester

This post has been deleted.

Dave BuchholzBeta Tester

Ray,

I am trying to get the checkbox array search to work when passing it as a $_GET e.g. /index.php?brands%5B%5D=25&brands%5B%5D=42 but when I view the sql output I see:
...WHERE (`pkBrand` = brands) ORDER BY CommonBrandName , SKU

My search looks like this:
$search_rsProductListing->setSearch(array("type"=>"Checkbox", "comparison"=>"=", "join"=>"AND"), array("pkBrand"), "i", "brands");

Do I need to do something different when working with url's ?

I am using ver 2.18 of rsobj.php as I updated the extension the other day.

Thanks.

Sign in to reply to this post

Ray BorduinWebAssist

Try:
$search_rsProductListing->setSearch(array("type"=>"Checkbox", "comparison"=>"=", "join"=>"AND"), array("pkBrand"), "i", (isset($_GET["brands"]?"1":"0"));

Sign in to reply to this post

Dave BuchholzBeta Tester

Fatal error: Cannot use isset() on the result of an expression (you can use "null !== expression" instead) in /Users/davidbuchholz/Dropbox/Sites/******-development/test-files/search/mysqli-results.php on line 14

Sign in to reply to this post

Ray BorduinWebAssist

I didn't put the parenthesis in correctly. That should have been:

$search_rsProductListing->setSearch(array("type"=>"Checkbox", "comparison"=>"=", "join"=>"AND"), array("pkBrand"), "i", (isset($_GET["brands"])?"1":"0"));

Sign in to reply to this post

Dave BuchholzBeta Tester

Ray, that has solved the error but the search still doesn't work. The url etc. are the same as the private message in the first post in this thread if you want to take a look.

Thanks.

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...