CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Question: MultSelect List Box

Print topic Send  topic

Author Message
stuartambient

Posts: 3
Posted: 09/19/2004, 7:22 AM

I am trying to get a multi select list box to function correctly but curently with no success. While I have an open support ticket on this, thought it would make sense to ask in here as well.
First, the desired functionality :
Multi select lives in a search form , there is an associated results grid.
User ,may choose any number of choices in list box and have returned all records that apply.
Example, user chooses red , white and blue. There are no red records in the database but white and blue records are returned. Similiarly , same choices , but only blue exist, so blue records are returned.

Right now, what's happening is if more then 1 choice is made, it seems to negate both and returns no records. Hence it's not functioning like a multi select.


HTML: (s_Industry is the name of the field variable)
<tr>
<td class="EasyStreetFieldCaptionTD" nowrap>Industry </td>
<td class="EasyStreetDataTD">
<select class="EasyStreetSelect" multiple name="{s_Industry_Name}">

{s_Industry_Options}

In the grid I set event "before build select" with custom code I got out of manual (on multi selects)

<?php
//BindEvents Method @1-CC21E26A
function BindEvents()
{
global $VendorJobs;
$VendorJobs->ds->CCSEvents["BeforeBuildSelect"] = "VendorJobs_ds_BeforeBuildSelect";
}
//End BindEvents Method

//VendorJobs_ds_BeforeBuildSelect @2-2C183C75
function VendorJobs_ds_BeforeBuildSelect()
{
$VendorJobs_ds_BeforeBuildSelect = true;
//End VendorJobs_ds_BeforeBuildSelect

//Custom Code @58-307BE7E4
// -------------------------
global $VendorJobs;
function Tasks_ds_BeforeBuildSelect() {
global $Tasks;

$s_Industry = CCGetParam("s_Industry", "");
if (count($s_Industry) > 0 AND is_array($s_Industry)) {
foreach ($s_Industry as $key => $value) {
if ($Projects != "") $Projects = $Projects.",";
$Projects = $Projects.$value;
}
if ($VendorJobs->ds->Where != "")
$VendorJobs->ds->Where .= " AND ";
if ($Projects != "")
$VendorJobs->ds->Where .= " VendorJobs.Industry IN (".$Projects .")";
}
}
//End Custom Code

//Close VendorJobs_ds_BeforeBuildSelect @2-8489EFD6
return $VendorJobs_ds_BeforeBuildSelect;
}
//End Close VendorJobs_ds_BeforeBuildSelect


?>
Vendor Jobs is the name of the grid, also in line "Where. = "VendorJobs.Industry IN ...."
That VendorJobs is the name of the table with the field.

I'm not a PHP expert, not even a novice, so in my attempt to read the code, I find no flaws.
As a side-question, I understand an array has been created in the above code, but I wonder if an Implode or Explode function might be bettter? Not that I would know how to create one ;-)

Any help here would be appreciated.

Thank you
Stuart
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.