CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 How do you set default selected values for a MULTIPLE ListBox?

Print topic Send  topic

Author Message
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?

View profile  Send private message
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?
View profile  Send private message
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.

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.