CodeCharge Studio
search Register Login  

Web Reporting

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

YesSoftware Forums -> Archive -> GotoCode Archive

 Multi Select on a search form

Print topic Send  topic

Author Message
Carlos de Carvalho
Posted: 05/27/2002, 6:21 AM

Does anyone have experience implementing a multi select on a search form. I am using codecharge 2 with php & templates. I have changed the select to multiple in the html and have changed the name property to s_PropertyCategoryId[],
however on the Grid form I am not able to access the array parameter. I have tried the method outlined in the following article to access the parameter, but it does not seem to work.

http://www.phpbuilder.com/forum/read.php3?num=2&id=104978&thread=100800


echo $HTTP_POST_VARS['s_PropertyCategoryId[0]']; //this returns nothing
echo "<br>".get_param('s_PropertyCategoryId[0]'); //this also returns nothing
$arrCategory = $HTTP_POST_VARS['s_PropertyCategoryId'];
$size = count($arrCategory);
echo "<br>Size: ".$size; // Size is 0
if (($size) > 0) {
for ($x = 0; $x<$size; $x++) {
$Category = $arrCategory[$x];
if ($Category) {
echo $Category;
}
}
}

Any help would be appreciated. Does anyone have an example project perhaps?
Elena
Posted: 05/29/2002, 4:50 AM

Carlos,
http://www.gotocode.com/UserImages/Elena/Classifieds.zip

download modified Classifieds example and refer to Categories page.
On the search form you can select several categories from listbox and get the results in Grid form.
To make it work:
1. global function is created (see Site->Modules-> Global Functions section). It works like the one you've posted but instead of printing categories values are added to WHERE. Function returns a part of WHERE clause that could be used on Grid.

2. Categories.html file (you'll find one in .zip file) requires some modifications. Namely, you should modify <select> tag. Generated one is:
<select name="category_id">
add size, MULTIPLE attribute and set array name:
<select size = 10 multiple name="category_id[]">

3. well, the last step is to add conditions returned by function to Grid form WHERE. You'll find the code in the Open event of Grid form.
George L.
Posted: 05/31/2002, 7:12 AM

Elena. Would this work theoretically on on insert to a table?

I'm trying to be able to select multiple items and pass them into an array. If I can do that then I should be able to modify the array and insert into my database?
Code by Elena
Posted: 10/02/2003, 6:05 PM

Does any body knows how to convert Elena's code example from PHP to ASP?

ANY HELP IS GREATLY APPRECIATED. THIS IS VERY IMPORTANT AS I AM LOOKING FOR SIMILAR SOLUTION FOR MY ASP 2.0 WITH TEMPLATES (CC 2.0) PROJECT.

Thanks in Advance
Nido
Code by Elena
Posted: 10/02/2003, 6:05 PM

Does any body knows how to convert Elena's code example from PHP to ASP?

ANY HELP IS GREATLY APPRECIATED. THIS IS VERY IMPORTANT AS I AM LOOKING FOR SIMILAR SOLUTION FOR MY ASP 2.0 WITH TEMPLATES (CC 2.0) PROJECT.

Elena's example is as follows
Multi Select on a search form
Author Elena
Date Created 5/29/2002 4:50:32 AM

http://www.gotocode.com/UserImages/Elena/Classifieds.zip

download modified Classifieds example and refer to Categories page.
On the search form you can select several categories from listbox and get the results in Grid form.
To make it work:
1. global function is created (see Site->Modules-> Global Functions section). It works like the one you've posted but instead of printing categories values are added to WHERE. Function returns a part of WHERE clause that could be used on Grid.

2. Categories.html file (you'll find one in .zip file) requires some modifications. Namely, you should modify <select> tag. Generated one is:
<select name="category_id">
add size, MULTIPLE attribute and set array name:
<select size = 10 multiple name="category_id[]">

3. well, the last step is to add conditions returned by function to Grid form WHERE. You'll find the code in the Open event of Grid form.


Thanks in Advance
Nido

   


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

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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