EoN
Posts: 6
|
| Posted: 07/15/2007, 11:17 PM |
|
Hi all,
I have a very simple, straight forward question, that I can't seem to find the answer to anywhere:
How do I set multiple default selected values for a MULTIPLE ListBox?
So for example for simplicity sake, lets say we have a ListBox defined as follows (with hard coded list values):
Name: lb_ListBox
Data Source Type: ListOfValues
Data Source: name;Name;address;Address;phone;Phone Number;something;Something
Now If i want to have TWO options selected by DEFAULT, (values: address and phone), how do I apply that in the BeforeShow event?
|
 |
 |
EoN
Posts: 6
|
| Posted: 07/16/2007, 4:20 PM |
|
Hi all,
I urgently need an answer to this. Any help would be greatly appreciated.
Seeing as this is inherent functionality of a standard basic html select element, I'm sure there's a way to do it in CodeCharge that I'm just not aware of? Please could someone point me in the right direction?
Of course the normal HTML way of doing this is:
<select name="my_select" multiple>
<option value="1" selected>One</option>
<option value="2">Two</option>
<option value="3" selected>Three</option>
</select>
So how do you programatically assign selected Selected Values for a hard coded list in the BeforeShow event as per the example above?
|
 |
 |
datadoit.com
|
| Posted: 07/17/2007, 4:48 PM |
|
Your listbox or radio button items are stored in an array, which can be
referenced/altered, etc. So what you have is this:
my_select BeforeShow event:
$Option1 = array("1", "One");
$Option2 = array("2", "Two");
$Option3 = array("3", "Three");
$Component->Values = array($Option1, $Option2, $Option3);
Make sure that your component is set for ListOfValues, put in some bogus
values, and set the content to HTML.
|
|
|
 |
|