close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

DataAssist Search, Using a multiple select option

Thread began 3/06/2013 6:16 am by vernon webb | Last modified 3/06/2013 7:34 am by Jason Byrnes | 547 views | 1 replies |

vernon webb

DataAssist Search, Using a multiple select option

I have a search page setup that has a menu list that I would like for a multiple item select to work on that page. Everything on the page works except the multiple select. In fact the works but with only one item. Is there something else I am supposed to be doing for that? I thought I was told I had to add a [] to the select name tag as such, however it is only returning one item from the list.

<select name="clientType[]" size="5" multiple="multiple" id="clientType[]">

Thanks.

Sign in to reply to this post

Jason ByrnesWebAssist

adding the square brackets to the name is the first part. the square brackets will allow the multiple select list, or checkbox to send the multiple selections. it creates an array of the selections that are made, use those selection in the search though, you need to do 2 more things on the results page:


1) Convert the array of selections to a comma separated list.

double check the search form method. If the search for method is set to GET, add the following code at line 1 of the results page:

php:
<?php

if($_SERVER["REQUEST_METHOD"] == "GET")     {
    foreach(
$_GET as $key => $val) {
        if(
is_array($_GET[$key])) $_GET[$key] = implode(", "$_GET[$key]);
    }
}
?>



if the search form method is POST, use this code at line 1:

php:
<?php

if($_SERVER["REQUEST_METHOD"] == "POST")     {
    foreach(
$_POST as $key => $val) {
        if(
is_array($_POST[$key])) $_POST[$key] = implode(", "$_POST[$key]);
    }
}
?>



2) in the Data Assist Search server behavior, make sure the clientType criteria is set to use the Key Word filter type. For the Keyword OR, use a comma and a space:
", "

for the keyword And, just enter AND:
"AND"

double check the search form method, if the method is set to get, make sure the code for the key word value uses the GET variable:

php:
<?php echo((isset($_GET["clientType"]))?$_GET["clientType"]:""?>



if the search form method is POST make sure the code for the key word value uses the POST variable:

php:
<?php echo((isset($_POST["clientType"]))?$_POST["clientType"]:""?>
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...