CodeCharge Studio
search Register Login  

Web Reports

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 Change each listbox value programmatically - How?

Print topic Send  topic

Author Message
Aleister

Posts: 73
Posted: 05/14/2004, 4:48 PM

hello,

I create a category->subcategory1...->subcategoryX system (unlimited subcategories). The purpose is to have content (sort of articles) which belongs to specific category-subcategory.

I Have no problem displaying in a grid exactly where each record belongs like: category1->Subcategory1->Subcategory2 e.t.c. But how can I display this in a drop-down box so it is simple to select exactly in which category belongs a new record - article?

A little more visual view of what I am trying to do:

Title: Let's travel
Select Category (listbox):
Europe
Europe -> Italy
Europe -> Germany
Europe -> France
Europe -> France -> Paris
e.t.c

The code which calculates each value is created but how can I change each listbox value before it appears?

Thanks,
Aleister
View profile  Send private message
Sixto Luis Santos
Posted: 05/16/2004, 2:23 AM

Hello Aleister,

You are describing dependent listboxes. At RexDesign (http://ccs.ath.cx)
we've created a Server Action to automate the process of creating such
listboxes. You just add the action and a label (to hold the javascript) and
it does the rest. The action only manage 2 listboxes though, but you can
check the generated code and manually create the third.

Regards,

Sixto
Aleister

Posts: 73
Posted: 05/16/2004, 2:48 PM

Hello Sixto,

My description sucks, I know, but it isn't about dependent listboxes, I need the Values in one listbox, not two or more.

The thing is I don't know how can I get each Value of the listbox before it shows and change it to something more readable, something I calculate by hand.

e.g.: Real Data of the listbox = ID

Record -> Before adding ID value to listbox

GetValue of ID -> custom code calculations -> SetValue Results

repeat for every listbox record


Thanks for your reply,
Aleister

View profile  Send private message
Sixto Luis Santos
Posted: 05/16/2004, 8:33 PM

Ok, I think I understand now. Well, if all you need to know is how to get
custom items inside a bounded listbox, here's how. The ListBox content (the
text values with their associated id) is stored in the "Values" property of
the control. The data is stored as an array of value pairs also stored as an
array. You can intercept the listbox in its "Before Show" event and alter
(or add) the data the way you want it. For a simple example:

1. Create a form and add a ListBox.
2. Select the ListBox and add code to its "Before Show" event.
3. Add this code:

$my_values=array(); // Initialize the master array
for($i=1;$i<=10;$i++) // Simple counter from 1 to 10
$my_values[]=array("ID$i","This is item #$i"); // Create the value-pair
array

$NewRecord1->ListBox1->Values=$my_values; // Assign the newly created array
to the listbox

4. Switch to Live View
5. Notice that the listbox now contains "This is item #x" **
6. Examine the "source" (right click, select view source) and check the IDs
are now "IDx" **

(** Where x is a number betwen 1 and 10)


Hope you can get it from here.

Regards,

Sixto


"Aleister" <Aleister@forum.codecharge> wrote in message
news:540a7e1cab87f9@news.codecharge.com...
> Hello Sixto,
>
> My description sucks, I know, but it isn't about dependent listboxes, I
need
> the Values in one listbox, not two or more.
>
> The thing is I don't know how can I get each Value of the listbox before
it
> shows and change it to something more readable, something I calculate by
hand.
>
> e.g.: Real Data of the listbox = ID
>
> Record -> Before adding ID value to listbox
>
> GetValue of ID -> custom code calculations -> SetValue Results
>
> repeat for every listbox record
>
>
> Thanks for your reply,
> Aleister
>
>
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

Aleister

Posts: 73
Posted: 05/18/2004, 7:39 PM

It worked just fine, Thank you Sixto.

Aleister

Quote Sixto Luis Santos:
Ok, I think I understand now. Well, if all you need to know is how to get
custom items inside a bounded listbox, here's how. The ListBox content (the
text values with their associated id) is stored in the "Values" property of
the control. The data is stored as an array of value pairs also stored as an
array. You can intercept the listbox in its "Before Show" event and alter
(or add) the data the way you want it. For a simple example:

1. Create a form and add a ListBox.
2. Select the ListBox and add code to its "Before Show" event.
3. Add this code:

$my_values=array(); // Initialize the master array
for($i=1;$i<=10;$i++) // Simple counter from 1 to 10
$my_values[]=array("ID$i","This is item #$i"); // Create the value-pair
array

$NewRecord1->ListBox1->Values=$my_values; // Assign the newly created array
to the listbox

4. Switch to Live View
5. Notice that the listbox now contains "This is item #x" **
6. Examine the "source" (right click, select view source) and check the IDs
are now "IDx" **

(** Where x is a number betwen 1 and 10)


Hope you can get it from here.

Regards,

Sixto


"Aleister" <Aleister@forum.codecharge> wrote in message
news:540a7e1cab87f9@news.codecharge.com...
> Hello Sixto,
>
> My description sucks, I know, but it isn't about dependent listboxes, I
need
> the Values in one listbox, not two or more.
>
> The thing is I don't know how can I get each Value of the listbox before
it
> shows and change it to something more readable, something I calculate by
hand.
>
> e.g.: Real Data of the listbox = ID
>
> Record -> Before adding ID value to listbox
>
> GetValue of ID -> custom code calculations -> SetValue Results
>
> repeat for every listbox record
>
>
> Thanks for your reply,
> Aleister
>
>
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>


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.

Web Database

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.