close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

DataAssist Multiple Search same field

Thread began 6/03/2009 5:02 pm by danjen | Last modified 11/03/2010 7:49 am by nickj | 2965 views | 7 replies |

danjenBeta Tester

DataAssist Multiple Search same field

I don't know what I am doing wrong, but I cannot get the multiple select list search to work.

I used the dataassist wizard to create a search and results page. I chose menu as the search option.

After the wizard was complete, on the search page I changed the menu to list and checked the allow multiple optiion.

I only get a list of first item selected. How can I get it to include all selections. The URL shows all 3.

HELP!!

I must be missing a step

Sign in to reply to this post

Ray BorduinWebAssist

Go to the results page and update the Search server behavior. Make sure it is specified as a type "list" in that interface. I think the Wizard does all type Value or Edit searches regardless of the form element because it doesn't directly support multiselect lists.

Should just be a matter of updating it in the server behavior at this point.

Sign in to reply to this post
Did this help? Tips are appreciated...

danjenBeta Tester

No it is set to list. Here is the code.
$WADbSearch2_DefaultWhere = "";
if (!session_id()) session_start();
if ("" == "") {
$WADbSearch2 = new FilterDef;
$WADbSearch2->initializeQueryBuilder("MYSQL","1");
//keyword array declarations

//comparison list additions
$WADbSearch2->addComparisonFromList("minor_class_code","Category2","AND","=",0);

//save the query in a session variable
if (1 == 1) {
$_SESSION["WADbSearch2_LaundryProducts"]=$WADbSearch2->whereClause;
}
}
else {
$WADbSearch2 = new FilterDef;
$WADbSearch2->initializeQueryBuilder("MYSQL","1");
//get the filter definition from a session variable
if (1 == 1) {
if (isset($_SESSION["WADbSearch2_LaundryProducts"]) && $_SESSION["WADbSearch2_LaundryProducts"] != "") {
$WADbSearch2->whereClause = $_SESSION["WADbSearch2_LaundryProducts"];
}
else {
$WADbSearch2->whereClause = $WADbSearch2_DefaultWhere;
}
}
else {
$WADbSearch2->whereClause = $WADbSearch2_DefaultWhere;
}
}
$WADbSearch2->whereClause = str_replace("\\''", "''", $WADbSearch2->whereClause);
$WADbSearch2whereClause = '';

Sign in to reply to this post

Ray BorduinWebAssist

In php you need to add square brackets to the list name in your html before it will work with multiselect.

So <select name="myname"> needs to be updated to <select name="myname[]">

It appears the code is correct, so the problem has to be in the way the form element is named.

Sign in to reply to this post
Did this help? Tips are appreciated...

danjenBeta Tester

Thank you Ray, that was the problem!! It was missing in the search page. Is it supposed to do that automatically? Maybe a bug?

Sign in to reply to this post

Ray BorduinWebAssist

It only needs to be added for multiselect lists. Since you changed it to a multiselect list, that is when you should have added the brackets. This is a general php thing. Any time you use a multiselect list in php you need to add brackets or it won't work. I suppose we could add them by default, but this is something you will need to know in general when working with multiselect lists in php (or checkbox groups).

Sign in to reply to this post
Did this help? Tips are appreciated...

drostenator386534

multiple select searches in php

I've just spent two days looking for that answer. 2 little brackets. so simple. Thanks.

Sign in to reply to this post

nickj

Can you point me to a tutorial or video or PDF which details multi select? Not sure where to find and how to apply.


Thanks

Nick

Sign in to reply to this post

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...