CodeCharge Studio | All ASP PHP Perl ColdFusion Java C#.NET VB.NET |
The values in a List Box control can be specified by using a list of values which appear in pairs. Each entry in a List Box is composed of a value which is displayed and another which is submitted, hence the pairs. Using event code, you can specify the pairs that will make up the entries of the ListBox.
In this example, we have a Status List Box which is located in a Tasks Record form.
Function Tasks_BeforeShow(Sender) Set Tasks.Status.DataSource = CCCreateDataSource(dsListOfValues, Empty, _ Array(Array("1","2","3"),Array("High","Normal","Low"))) End Function
function Tasks_BeforeShow(& $sender) { global $Tasks; $Tasks->Status->Values = array(array("1", "High"),array("2", "Normal"), array("3", "Low")); }
sub Tasks_BeforeShow() { $Tasks->{Status}->{Values} = [["1", "High"],["2", "Normal"], ["3", "Low"]]; }
<!--Tasks_BeforeShow ---> <CFSET arr_tasksStatus=ListToArray("1;High;2;Normal;3;Low",";")>
'Tasks_BeforeShow item.statusItems.Clear() tasksstatus.Items.Clear() item.statusItems.Add("","Select Value") item.statusItems.Add("1", "High") item.statusItems.Add("2", "Normal") item.statusItems.Add("3", "Low") item.statusItems.CopyTo(tasksstatus.Items)
//Tasks_BeforeShow item.statusItems.Clear(); tasksstatus.Items.Clear(); item.statusItems.Add("","Select Value"); item.statusItems.Add("1", "High"); item.statusItems.Add("2", "Normal"); item.statusItems.Add("3", "Low"); item.statusItems.CopyTo(tasksstatus.Items);
//Tasks_BeforeShow e.getRecord().getList("status").setListOfValues("1;High;2;Normal;3;Low");