CodeCharge Studio
search Register Login  

Web Reporting

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

YesSoftware Forums -> Archive -> CodeCharge.Discussion

 Small bug report

Print topic Send  topic

Author Message
Jeff Stuart
Posted: 04/25/2001, 4:55 PM

Ok... small bug report...

I setup a list box field and assigned it a List of Values. Here is what my
list looked like:

1;Please Select a Category;
Web Hosting;Web Hosting;
Image Providers;Image Providers;

NOTE: I had a carriage return after EACH entry on the list. It then
generated the following PHP code (minus >>> and <<<):

$LOV = split(";", "1;Please Select a Category;
Web Hosting;Web Hosting;
Image Providers;Image Providers;");

if(sizeof($LOV)%2 != 0)
$array_length = sizeof($LOV) - 1;
else
$array_length = sizeof($LOV);
reset($LOV);
for($i = 0; $i < $array_length; $i = $i + 2)
{
>>> $tpl->set_var("ID", $LOV[$i])); <<<
>>> $tpl->set_var("Value", $LOV[$i + 1])); <<<
if($LOV[$i] == $fldresource_cat1)
$tpl->set_var("Selected", "SELECTED");
else
$tpl->set_var("Selected", "");
$tpl->parse("LBresource_cat1", true);
}

Which in turn generates the following HTML code:

<select name="resource_cat1">

<option value="1" >Please Select a Category</option>

<option value="
Web Hosting" >Web Hosting</option>

<option value="
Image Providers" >Image Providers</option>
</select>

Note the carriage return after the first entry on the list.

Now.. if I replace the PHP code (denoted with >>> and <<< on the line) with
the following code, it generates a proper list.

$tpl->set_var("ID", trim($LOV[$i])));
$tpl->set_var("Value", trim($LOV[$i + 1])));

Also, since you're not using a regular expression on the split line, you
could replace it with the following code to make it run faster:

$LOV = explode(";", "1;Please Select a Category;
Web Hosting;Web Hosting;
Image Providers;Image Providers;");

--
Jeff Stuart
jstuart@neo.rr.com


Jeff Stuart
Posted: 04/25/2001, 10:40 PM

Followup to myself.. :)

Found another small problem... which turns out to be the same thing... when
I came back to edit the record with this form, it wasn't selecting the value
from my drop down list. Basically the fix is ANYWHERE we refer to either
$LOV[$i] or $LOV[$i+1] replace that with a trim($LOV[...]).

On a completely different note... I have a record type form. According to
the help, I should have an event called Custom Update. However, it doesn't
show up on my list of available events. :( I can get away with using an
after update but it would have been nice to save the update to the DB since
I'm immediately going to be deleting the record. In this case, the table is
a temp holding table until either the submissions is approved in which case,
it goes into the main table or else it's deleted by hand... QED.. no need to
save our changes back to the temp table.

--
Jeff Stuart
jstuart@neo.rr.com

"Jeff Stuart" <jstuart-devel@neo.rr.com> wrote in message
news:9c7o59$4jg$1@mail.tankhill.com...
> Ok... small bug report...
>
> I setup a list box field and assigned it a List of Values. Here is what
my
> list looked like:
>
> 1;Please Select a Category;
> Web Hosting;Web Hosting;
> Image Providers;Image Providers;
>
> NOTE: I had a carriage return after EACH entry on the list. It then
> generated the following PHP code (minus >>> and <<<):
>
> $LOV = split(";", "1;Please Select a Category;
> Web Hosting;Web Hosting;
> Image Providers;Image Providers;");
>
> if(sizeof($LOV)%2 != 0)
> $array_length = sizeof($LOV) - 1;
> else
> $array_length = sizeof($LOV);
> reset($LOV);
> for($i = 0; $i < $array_length; $i = $i + 2)
> {
> >>> $tpl->set_var("ID", $LOV[$i])); <<<
> >>> $tpl->set_var("Value", $LOV[$i + 1])); <<<
> if($LOV[$i] == $fldresource_cat1)
> $tpl->set_var("Selected", "SELECTED");
> else
> $tpl->set_var("Selected", "");
> $tpl->parse("LBresource_cat1", true);
> }
>
> Which in turn generates the following HTML code:
>
> <select name="resource_cat1">
>
> <option value="1" >Please Select a Category</option>
>
> <option value="
> Web Hosting" >Web Hosting</option>
>
> <option value="
> Image Providers" >Image Providers</option>
> </select>
>
> Note the carriage return after the first entry on the list.
>
> Now.. if I replace the PHP code (denoted with >>> and <<< on the line)
with
> the following code, it generates a proper list.
>
> $tpl->set_var("ID", trim($LOV[$i])));
> $tpl->set_var("Value", trim($LOV[$i + 1])));
>
> Also, since you're not using a regular expression on the split line, you
> could replace it with the following code to make it run faster:
>
> $LOV = explode(";", "1;Please Select a Category;
> Web Hosting;Web Hosting;
> Image Providers;Image Providers;");
>
> --
> Jeff Stuart
>jstuart@neo.rr.com
>
>
>


   


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.