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

 Format checkboxlist function

Print topic Send  topic

Author Message
yeowza

Posts: 16
Posted: 01/07/2009, 11:43 AM

I had to create a function to try and format checkboxlists. I have an advanced search I created that has a large number of checkboxlists on the page. I needed a way to format them all easily since a single line list didn't work. I wrote this function. It works so I thought I would pass it along. I'm sure it could be improved.

I name all of my checkboxes sequentially.

In the beforeshow for the page I add these calls. The first parameter is the value to append to the checkbox name. The 2nd one is the number of columns you want in a line.

formatchecklistx("1",5);
formatchecklistx("2",5);
formatchecklistx("3",6);
formatchecklistx("4",6);

Then add this function in the page code.

function formatchecklistx($num,$col){
global $tblresumeSearch; //Compatibility

$list = "CheckBoxList".$num;
$label = "Label".$num;
$val = "<table><tr><td>";
$tblresumeSearch->$label->SetValue($val);
$cnt = count($tblresumeSearch->$list->Values);
$inc = 1;
for ($i = 0; $i<$cnt; $i+=$inc) {
$c2 = $i + 1;
$val = "</td>";
if ($c2 == $cnt){
$val .= "</tr></table>";
} else {
if ($col > 0) {
$rem = $c2 % $col;
} else {
$rem = 0;
}
if ($rem == 0) {
$val .= "</tr><tr><td>";
} else {
$val .= "<td>";
}
}
$tblresumeSearch->$list->Values[$i][1] .= $val;
}
}
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.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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