ComboBox created in AS

I am creating a bunch of ComboBoxes at run time according to
some info loaded from an XML file.
The problem is I have no idea how to grab the selectedItem
when the user clicks in an option.
I have tried
myComboBox.close(onClose()), but Flex gives me an error
Any suggestions?
Gilbert

Ok. I found out the solution.
I replaced myComboBox.close(onClose()) with
myComboBox.addEventListener(DropdownEvent.CLOSE, OnCBChange);
Gilbert

Similar Messages

  • Fxml  ComboBox created in scene builder how to fetch data from database

    Hi Sir, How r u? Hope to be fine. Sir, I have a problem that i want to fetch data in fxml comboBox created in Scene Builder?
    I have used this code in JavaFx 2.0 for comboBox and textField the code is
    ComboBox studentRegId = new ComboBox();
    try{
    stm = db.con.createStatement();
    rs = stm.executeQuery("select * from students order by s_reg_id asc");
    while(rs.next()){               
    for(int i=1; i<=1; i++)
    studentRegId.getItems().add(rs.getString("s_reg_id"));
    }catch(SQLException sqlException){         
    final TextField sRegId = new TextField();
    final String regId[] = new String[1000];
    try{
    stm = db.con.createStatement();
    rs = stm.executeQuery("select * from students order by s_reg_id asc");
    int a = 0;
    while(rs.next()) {
    regId[a] = rs.getString("s_reg_id");
    a++; }
    }catch(SQLException sqlException){         
    studentRegId.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>(){
    public void changed(ObservableValue ov,Number value, Number new_value){                           
    sRegId.setText(regId[new_value.intValue()]);
    Now, the problem is that I want to use this code in Scene Builder fxml ComboBox .
    Please Help Me!
    I shall be very grate full to you for this kindness.
    Regards

    Hi,
    Ok, so you create your FXML :
    Add a controller property to your root control. (See Code tab in SceneBuilder or direcly in FXML : fx:controller tag)
    Add a fx:id to your controls (your combobox) (First property in SceneBuilder or directly in FXML : fx:id)
    Example :
    <?xml version="1.0" encoding="UTF-8"?>
    <?import java.lang.*?>
    <?import java.util.*?>
    <?import javafx.collections.*?>
    <?import javafx.scene.control.*?>
    <?import javafx.scene.layout.*?>
    <?import javafx.scene.paint.*?>
    <HBox prefHeight="-1.0" prefWidth="-1.0" xmlns:fx="http://javafx.com/fxml" fx:controller="org.lgringo.comboexample.Controler">
      <children>
        <TextField fx:id="text" prefWidth="100.0" />
        <ComboBox fx:id="combo" prefWidth="200.0">
          <items>
            <FXCollections fx:factory="observableArrayList">
              <String fx:value="Item 1" />
              <String fx:value="Item 2" />
              <String fx:value="Item 3" />
            </FXCollections>
          </items>
        </ComboBox>
      </children>
    </HBox>Then, you create your Controler class using @FXML annotation (name of control should be the name of fx:id properties)
    You can do some initialisation in the inherit method "initialize"
    Example :
    package org.lgringo.comboexample;
    import javafx.fxml.FXML;
    import javafx.scene.control.ComboBox;
    import javafx.scene.control.TextField;
    public class Controler {
         @FXML
         // fx:id="combo"
         private ComboBox<String> combo; // Value injected by FXMLLoader
         @FXML
         // fx:id="text"
         private TextField text; // Value injected by FXMLLoader
         @FXML // This method is called by the FXMLLoader when initialization is complete
        void initialize() {
            assert combo != null : "fx:id=\"combo\" was not injected: check your FXML file 'ComboboxExample.fxml'.";
            assert text != null : "fx:id=\"text\" was not injected: check your FXML file 'ComboboxExample.fxml'.";
            // Initialize your logic here: all @FXML variables will have been injected
            combo.getItems().clear();
            combo.getItems().addAll("John Lennon","Mick Jagger","David Bowie");
            combo.getItems().add("Others...");
            text.setText("List : ");
    }Then you use the FXMLLoader class to load your FXML and Controler.
    Example :
    package org.lgringo.comboexample;
    import javafx.application.Application;
    import javafx.fxml.FXMLLoader;
    import javafx.scene.Parent;
    import javafx.scene.Scene;
    import javafx.stage.Stage;
    public class App extends Application {
          * @param args
         public static void main(String[] args) {
              App.launch(args);
         @Override
         public void start(Stage primaryStage) throws Exception {
              Parent root = FXMLLoader.load(getClass().getResource("ComboboxExample.fxml"));
              primaryStage.setTitle("Combo Example");
              primaryStage.setScene(new Scene(root, 300, 275));
              primaryStage.show();
    }More info : http://docs.oracle.com/javafx/2/get_started/fxml_tutorial.htm

  • Combobox created in PHP is displayed so small - its unreadable.

    Created combobox using PHP and mysql. The combobox display is very narrow and the font is too small to read. It displays as desired on both Chrome and IE9. Not sure whether I need to set some Firefox option or whether this is a tech problem. Tried the zooming functions but did not affect the combobox size. The rest of the page looks normal. I am using Firefox version 7.0.1

    cat /etc/systemd/system/php5-fpmc.service
    [Unit]
    Description=The PHP FastCGI Process Manager
    After=network.target
    [Service]
    Type=forking
    #PIDFile=/var/run/php5-fpm.pid
    PIDFile=/media/root-samsu/chroot-arch/pids/php-fpm.pid
    RootDirectory=/media/root-samsu/chroot-arch
    ExecStartPre=sh -c 'errors=$(/usr/sbin/php-fpm --fpm-config /etc/php/php-fpm.conf -t 2>&1 | grep "\[ERROR\]"); if [ -n "$errors" ]; then echo "Please fix your configuration file..."; echo $errors; exit 1; fi'
    ExecStart=/usr/sbin/php-fpm
    #--fpm-config /etc/php/php-fpm.conf
    ExecReload=/bin/kill -USR2 $MAINPID
    [Install]
    WantedBy=multi-user.target
    cat /etc/php/php-fpm.conf | grep -v ";" |grep -v "^$"
    [global]
    pid = /pids/php-fpm.pid
    [www]
    user = http
    group = http
    listen = 9005
    listen.owner = http
    listen.group = http
    listen.mode = 0660
    pm = dynamic
    pm.max_children = 15
    pm.start_servers = 2
    pm.min_spare_servers = 1
    pm.max_spare_servers = 7
    security.limit_extensions = .php .php3 .php4 .php5 .html .htm
    if it were me, would place the sockets in the folder where I put pids, (if same user, and same permisions (php and nginx)) is to easy if you manualy chroot an fix permisions) check/look as you see the permissions on folders, if dont use socket for a long time, but i test it (i can't rewrote nginx config)
    listen = /pids/php-fpm_Domaintolisten.socket
    Last edited by Alambre (2013-08-29 22:39:28)

  • Removing Keyborard Listener from ComboBox

    I have a ComboBox created and when I select the comboBox and
    press the down/up keyboard it moves from next/previous item in the
    comboBox list. I want to remove this feature. down/up/right/left
    keyboards control a movieclip but when this comboBox is selected it
    doesn't work because of this ComboBox.
    Thanks in advance.

    Please help me!!!

  • Referencing runtime created form items

    How do I reference a ComboBox created at runtime in actionscript?
    itemCheckbox =
    new CheckBox();myForm.addChild(itemCheckbox);
    The name property does not seem to work.

    Refer to above post, You need to set the name property of your child explicitly then only you can be able to access this child by using getChildByName method.
    By saying:
    var myCheckBox:CheckBox = new CheckBox();
    and accessing by using myClass.getChildByName("myCheckBox").visible = false; this will not work coz myCheckBox is a reference to the child not a name assigned to the child.
    Also you can refer to this link earlier posted in forum :
    http://forums.adobe.com/message/2708552#2708552
    Further you may achieve your task by
    var myCheckBox:CheckBox = new CheckBox();
    myCheckBox.name = "myCheckBox" ;
    now try to access your checkbox by saying :
    myClass.getChildByName("myCheckBox").visible = false;
    Hope this helps you
    Cheers
    -Vikash

  • ArrayCollection vs. Array in HTTPService sending

    Hi,
    I want to send the content of an ArrayCollection as one of the parameters in an HTTPService.
    However, Flex concatenates the collection's values into one long string and sends it as the value of a single parameter.
    Doing this with arrays work just fine, e.g. in AS3:
         service.send( { name=["john", "lucy", "mark"] });
        (also works in MXML using parameter binding)
    So then I tried first converting the ArrayCollection using .toArray()   -  this is done in MXML, e.g.:
         name="{controller.name.toArray()}"
    But, then Flex thinks there is NO value - i.e. data binding to the result of .toArray() doesn't keep track of changes to the underlying ArrayCollection.
    Is there any way to databind a single HTTPService parameter to an ArrayCollection like one can do against an Array?
    Joubert

    It will be easier to show you an example of the ArrayCollection. Run this example with a line break at the trace(); statement, and examine the resulting ArrayCollection's items. Once you see this, I think you'll understand why your code isn't working as you expect.
    The ArrayCollection is not simply a way to store or make a single Array bindable. It is a collection of objects which you can bind to. Its methods allow you to add, delete and search for items within it. You can, in fact, store many arrays within it. And those arrays could be using Flex components as object keys. Even if you send this to a WebService, that service will likely not understand it.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
         creationComplete="testIt()">
    <mx:Script>
        <![CDATA[
            import mx.controls.ComboBox;
            import mx.collections.ArrayCollection;
            import flash.utils.Dictionary;       
            //Create different types of arrays:
            public var indexedArray:Array = new Array("john", "lucy", "mark");       
            public var associativeArray:Array = new Array([
            {label:"One", data:"7000"},
            public var dictionaryArray:Dictionary = new Dictionary();
            //Create objects for a dictionary array:
            public var objectOne:Object = new Object();
            public var objectTwo:Object = new Object();
            public var sprite1:Sprite = new Sprite;
            public var comboBox1:ComboBox = new ComboBox;
            //Create an ArrayCollection:
            private var myAC:ArrayCollection = new ArrayCollection;
            //This function populates the ArrayCollection:
            private function testIt():void{
                //Add values to the objects:
                objectOne = "This is a Sprite Object";
                objectTwo = "This is a ComboBox Object";
                //Add objects to the Dictionary:
                dictionaryArray[sprite1] = objectOne;
                dictionaryArray[comboBox1] = objectTwo;
                //Add all the Arrays to the Collection:
                myAC.addItem(indexedArray);
                myAC.addItem(associativeArray);
                myAC.addItem(dictionaryArray);
                trace();
        ]]>
    </mx:Script> 
    </mx:Application>

  • Issues with Userforms in Excel 2013

    Hi
    I have some issues with Userforms and Comboboxes created in earlier versions of Excel (2010). The VBA Code get stuck when I try to use the userforms in Excel 2013.
    It is either the addItem function or the Userfrom.Show function which fails.
    I have Installed a old version of excel (2007) on the same computer and when I run the same code on in this version the code works perfect. I have also tried the code on several other computers and got the same answer - Does not work in 2013 but works perfect
    in previous versions.  
    Is there a known bug in this issue??
    With best regads
    Joakim

    Hi,
    This is the forum to discuss questions and feedback for Microsoft Excel, I'll move your question to the MSDN forum for Excel
    http://social.msdn.microsoft.com/Forums/en-US/home?forum=exceldev&filter=alltypes&sort=lastpostdesc
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
    George Zhao
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • Problems in editable Combo Box

    Hello,
    I have an editable Combo Box and an action listener associated with the Combo Box. I also have a "Store" button that stores the edited item in the Combo Box and an action listener associated with the button too. After I have selected an item in the Combo Box and edited it, I press the "Store Button". Instead of going to the Store_button_action performed method, it goes to the ComboBox_action performed method and after running it, it stops. Which means it does not run the Store_button_action performed method at all.
    Another thing I have noticed is that when ever I select any item from this Combo Box it gets highlighted in blue, is there some way around this? I want the cursor to be blinking at the beginning/end of the selected Item.
    Thanks and regards,
    Ibha

    Hi,
    you can use a Textfield as editor component for a ComboBox:
    create a class implementing javax.swing.ComboBoxEditor with an attribute type Textfield. This TextField uses your PlainDocument.
    In getEditorComponent() you return the TextField.
    Hope this helps,
    Phil

  • Adding variables to LoadVars

    I have an application that reads a PHP script and populates
    the Flash applets using the following on frame 1:
    if (_root.c.n <= 0) {
    c = new LoadVars();
    c.onLoad = showContent;
    c.sendAndLoad("varReturn.php",c,"post");
    A combobox (created with the returned data) is created on
    frame 61. When a selection is chosen in the combobox I need to add
    the value returned from the combobox to the variable catvar, add
    this variable to the LoadVars object and run the script again. It
    seems to set c.catvar initially but when I use the 'sendAndLoad
    command the second time c.catvar isn't included.
    Is it possible to add variables to a LoadVars object created
    on frame 1 from frame 61?

    You are not using
    LoadVars.sendAndLoad
    properly.
    You need TWO LoadVar variables. One for the sending and one
    for the return values. You do not have an onLoad method attached to
    the send LoadVars object but rather for the return LoadVars object.
    Look at the example in help for
    LoadVars.sendAndLoad
    . It is a perfect model to do what you want to do.

  • How to create combobox to display more than one columns

    I need kind help with the following question. As the combobox includes two pieces--textbox and the combobox list. Then how to create a combo box bean, which is based on table EMP(empno number(6), ename varchar2(40)) records for example, to achieve these features:
    1) allow more than one columns to be displayed in its records list--e.g., I need to show these records:
    empno (value) ename (label)
    103 David M Baker
    104 David M Baker
    105 Kelly J Volpe
    106 Krista F Carpenter
    107 Michelle P Silverman
    The two 'David M Baker's are different employees, but unfortunately, with the same name.
    2) allow combo box list to return the column value 'empno' even though it shows both columns as above. i.e., if user picks the second record above, then the combobox list returns 104 to the textbox in the background, but the 'David M Baker' is displayed on the textbox. Of course the combobox list may return 'David M Baker' if needed when there is only one column in the list as the current standard feature.
    3)allow partial match search by typing in some letters. i.e., if user types in the textbox of the combobox letter 'K' or 'k' then the partially matched records
    105 Kelly J Volpe
    106 Krista F Carpenter
    should be automatically displayed in the combobox list, not the whole list as above; then user may double click to choose one of the two or if user continues to type in 'R' or 'r', then the uniquely matched record 'Krista F Carpenter' is displayed in the textbox and the 106 is returned to the textbox.
    4) as a bonus if it's doable, allow combobox to return values to different textboxes when its records list has more than one columns.
    The reason I need these features is that I am working on the project migrated from Microsoft Access applications to centralized Java version web application. We at beginning promised to users community that Java swing will provide all the GUI user friendly features Microsoft Access has, but now we got stucked--we ate our words and got tons of complains from our users community. This is just the most needed component I posted here. I really hope that Java would add all the default GUI user-friendly features to compete with MS since its Win95 GUI has been accepted as industry standard. And most users are used to it. They claimed that they don't know and don't care what tool you use the newly created application should be more user friendly, not the opposite.
    I would be very much appreciated if any one would help me with this item.

    Thanks for your comments. I think nobody expects Sun to write everything including special features for its components. But I do think Sun should provide at least those standard user-friendly features for the GUI components because most users have been used to the GUI user-friendly features provided by Win95 and Access/Excel applications. Then this will help us to productively create applications to beat MS applications.
    Other wise like me, to get the existing GUI features, existed in old MS Access application, for our migrated Java application, I must re-create the GUI components library first which is a big burden to me at least, for others it might be fun for coding on their own from scratch, but I have to focus on the timing of project.
    If you really can pass the request to Sun and push them move a bit, please pass these words: before Sun starts to revise them, please play around window GUI, e.g., Access/Excel applications, then plan what to do, the bottom line is to equally match or better than them in FUNCTIONALITY(Look and feel is not my focus here). Don't ignore the influence of Windows regardless of you hate it or love it, the reality is most users are so familiar with windows GUI features which are accepted as industry standard. Thus the choice is to match or better to beat them. Don't make your car by closing your door, don't assume users will like what you come out in a closed room.

  • Is there a way to create a Cascading ComboBox populated by an SQL/SDK query to a table? Referenced Lists too hard to maintain.

    Background:
    I’m looking for an alternative to using referenced Enum (aka Lists) for “dropdowns” (aka “ComboBoxes”) in the forms.
    The reason for looking for an alternative mechanism for drop-downs was that using referenced Enums
     ran into issues when the List items in the enum were to be updated:
    The SCSM Console refuses to allow for the deletion of the referenced 
    Enum MP when there are other MPs referring to it.
    The SCSM Console doesn’t allow the editing of a sealed Enum MP’s List items.
    One has to hand-add new list items to the Enum MP’s XML.
    Importing that new Enum MP over the old one causes views to not show data for the changed Enum.
    The Customer wants the dropdown choices to be dynamically updated.
    The Customer also wants this to be user-friendly “for the masses”, meaning that hand-editing XML and tinkering with the SCSM Console is undesirable.
    We had enumeration lists with hundreds of choices, making hand-entry, using the SCSM Console, inordinately lengthy, error prone, and, frankly, tedious.
    What I’m looking for:
    The deeper requirements implied in these three Use Cases below are:
    The system has to be easily maintainable.
    The system has to reflect the latest changes in data.
    The system has to be usable by “the masses”.
    Large sets [200+]  of choices have to be machine importable.
     [Note: one reason why enums are not desirable is that we have had
    hundreds of choices to add and a manual approach was not feasible]
    Not as a prescription for a solution, but as a way of showing what I am looking for through an example-that-says-more-than-a-thousand-words: I want to implement the Service Manager usage-equivalent of a
     “Cascading Dropdown” (aka “Cascading ComboBoxes”) instead of using Enums. It doesn’t have to use
    Cascading Dropdowns but allow for the back-end ease-of-use that comes with it.
    Use Cases:
    Use Case 01:  A User wants to edit the contents of a Windows Computer CI record.
    Say that I want to change the field Business Unit and its associated field
    Customer
    You pick one element from a list of Business Unit choices.
    The act of clicking on that field triggers a SQL search through a table of all current customers and populates the dropdown for the field
    Business Unit.
    Say, for the sake of an example, you pick the Business Unit “Accenture AO”.
    The act of chosing “Accenture AO” triggers another SQL search through a table to find all
     Customer values that belong to the Business Unit “Accenture AO” and that filtered set is used to populate the dropdown for
    Customer.
    The user chooses “Planet Express”.
    The act of chosing “Planet Express” triggers a final SQL search through a table to find what the two-letter code is for “Accenture AO” + “Planet Express”, say “PE”. That value is used to set a
    hidden field.
    Use Case 02: Maintaining the tables used to populate Business Unit and
    Customer lists
    Say I’m an Admin who wants to update Business Unit and Customer
    lists as there have been the creation of a new Business Unit “Accenture Galactic” and there have been new Customers ”Klingon Karrier”, “Romulan Relaxair”, and “Federation Fun” and, say,
    two-hundred other Customers, with their two-letter codes “KK”,”RR”,”FF”…etc…etc..etc… respectively.
    I open a table editor for Business Unit and Customers.
    I have, say a CSV that has the Business Unit, Customer, and Code field and 200+ records
    I import using some automated mechanism the 200+ records.
    Use Case 01-B: A user immediately has their choices updated.
    Say that I want to change the field Business Unit and its associated field
    Customer
    You pick one element from a list of Business Unit choices.
    The act of clicking on that field triggers a SQL search through a table of all current customers and populates the dropdown for the field
    Business Unit.
    Say, for the sake of an example, you pick the Business Unit “Accenture Galactic”.
    The act of chosing “Accenture Galactic” triggers another SQL search through a table to find all
     Customer values that belong to the Business Unit “Accenture Galactic” and that filtered set is used to populate the dropdown for
    Customer.
    The user chooses “Federation Fun”.
    The act of chosing “Federation Fun” triggers a final SQL search through a table to find what the two-letter code is for “Accenture Galactic” + “Federation Fun”, say “PE”. That value is used to set a
    hidden field: “FF”

    consider
    http://blog.scsmsolutions.com/2011/08/create-custom-user-control-for-scsm-2010/ and http://social.technet.microsoft.com/Forums/en-US/09813153-a4d0-4bce-8d28-3ccc63bd72a1/resources-for-adding-custom-wpf-controls-to-service-manager-forms?forum=customization
    As for the Data Typing, the class property would be a String type, which maps to NVARCHAR in SQL, so any unicode characters, including XML (i'd recommend keeping it below 4000 for performance reasons). look to how the UserInput control works in Service Requests. 
    I would recommend a class extension woth a single string property to store the data on the windows computer class, and a separate stand-alone class to store your "options". no relationship should be implied. 

  • Creating A Class For A ComboBox Component

    I have a comboBox component that I would like to create a
    class for. But I am not sure if I could. I see how you can use the
    Linkage window to assign an AS 2.0 Class to a movie clip, but I do
    not see that same option for a comboBox component.
    It has all of the basic combo box things that I would like to
    seperate out into it's own class if possible
    If anyone could give me a few tips, or better yet, point me
    to a few good tutorials, that would be great.
    Thanks
    Mathias

    I have a comboBox component that I would like to create a
    class for. But I am not sure if I could. I see how you can use the
    Linkage window to assign an AS 2.0 Class to a movie clip, but I do
    not see that same option for a comboBox component.
    It has all of the basic combo box things that I would like to
    seperate out into it's own class if possible
    If anyone could give me a few tips, or better yet, point me
    to a few good tutorials, that would be great.
    Thanks
    Mathias

  • How can I create the component like ComboBox in flashlite2.0 ?

    How can I create the component like ComboBox in flashlite2.0
    I'm a new man, please gave me an example!
    Thanks.

    I don't see anything special about the play button in MPMoviePlayerController....
    the "glowing" effect icons are all standard UIBarButtonItem objects:
    http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIBarBut tonItem_Class/Reference/Reference.html

  • How to create dynamic combobox

    hi Gurus,
    I have a jsp page and I want to setup a combobox on it that will get clientnames from the databse(mysql). Can someone give me source code to get the job done. I have class for connection.
    here is my code for class
    package admin;
    import java.sql.*;
    //     http://www.javaservice.net/%7Ejava/bbs/read.cgi?b=javatip&c=r_p&m=devtip&n=1014323889&s=t
    public class DBPool {
         private static boolean connect = false;
         private static Connection[] cons = null;
         private static int maxCons = 10;
         //private static Boolean[] consStatus = new Boolean[maxCons];
         private static int conID = -1;
         private static final String dbURL = "jdbc:mysql://localhost:3306/virsarmedia";
         private static final String user = "root";
         private static final String password = "";
         // This DB Pool needs to be re-written so that uses Vector(or Hashtable)
         // not to share one Connection for many Statements
         static{
              try
                   System.out.print("Loading MySQL Driver ... ");
                   Class.forName("org.gjt.mm.mysql.Driver");
                   System.out.println("OK");
              }catch(ClassNotFoundException e){System.out.println(e.getMessage());}
         // create Connection
         public static final synchronized Connection createConn(){
              try{
                   return DriverManager.getConnection(dbURL,user,password);
              } catch (SQLException e){
                   e.printStackTrace();
                   return null;
         // get db pool manager
         public static final synchronized Connection getConnMgr(){
              // create connections when it's called at the first
              if(!connect){
                   cons = new Connection[maxCons];
                   for(int i=0; i<maxCons; i++){
                        cons[i] = createConn();
                        if(cons[i] == null) return null;
                   connect = true;
              // round robin returning Connection
              conID++;
              if(conID <= maxCons) conID = 0;
              try{
                   if(cons[conID].isClosed()) cons[conID] = createConn();
              } catch(SQLException se){
                   System.out.println(se.getMessage());
                   cons[conID] = createConn();
              return cons[conID];
         // destory all connections
         public static final void destory(){
              connect = false;
              for(int i=0; i<maxCons; i++){
                   if(cons[i] != null){
                        try{
                             cons.close();
                        } catch(SQLException se){
                             cons[i] = null;
              cons = null;
         // get numberOfRows
         public static final int getRows(ResultSet rs){
              int numberOfRows = 0;
              try{
                   rs.last();
                   numberOfRows = rs.getRow();
                   rs.beforeFirst();
              } catch(SQLException se){
                   se.printStackTrace();
              return numberOfRows;
    I have a servet doing the job of retrieveing the records from the databse.
    I want to retrieve all records client names from the databse and display it in the combo box.package data;
    import admin.*;
    import business.*;
    import java.sql.ResultSet;
    import java.sql.*;
    import java.util.Vector;
    public class ClientDB {
         final static String TBL_USER = "client";
    public static int readClientID(Connection connection, Client client) throws SQLException{
    //This method will return 0 if ClientID isn't found.
    String query = "SELECT ClientID FROM Client " +
    "WHERE ClientID = '" + client.getClientID() + "'";
    Statement statement = connection.createStatement();
    ResultSet record = statement.executeQuery(query);
    record.next();
    int clientID = record.getInt("ClientID");
    record.close();
    statement.close();
    return clientID;
    Here is code for JSP where I want to set combobox <%@ page import="java.util.*" %>
    <%@ page language="java" %>
    <%@ page import="java.sql.*" %>
    <%@ page import="admin.*" %>
    <%@ page import="data.*" %>
    <%
    String query = "SELECT clientName from client";
         //     Statement statement = null;
         %>
    <SELECT NAME="userSelectedCategory" onChange="this.form.submit();">
    <%
    try{
                   Statement statement = connection.createStatement();
    ResultSet result = statement.executeQuery(query);
              }catch(Exception e){
                   e.printStackTrace();
              } finally{
                   try{
                        if(statement != null) statement.close();
                   }catch(SQLException se){
                        se.printStackTrace();
    //Create a blank first option so the onChange event works.
    out.println("<option value=\"-\">-</option>");
    //Loop though all the categories in the database
    while(result.next())
    //This is a category from the database
    String optionCategoryValue = result.getString(1);
    //Construct the option tag in a String variable
    String optionTag = "<OPTION VALUE=\"" + optionCategoryValue + "\"";
    if(optionCategoryValue.equals(userSelectedCategory))
    optionTag += " selected=\"selected\"";
    //close the option tag
    optionTag += ">" + optionCategoryValue + "</OPTION>";
    //printout the option tag
    out.println(optionTag);
    //Close the result set and statment to free up resoures
    %>
    </SELECT>
    }Everything else is ok except the combo. Infact I don't know how I can set it. I am trying to do this since last 48 hours. please help me.
    Thanks                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Sorry Code for JSP is wrong here is right CODE. I am sorry about that
    <!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN//">
    <html>
    <link href="../virsar.css" rel="stylesheet" type="text/css" />
    <head>
    <title>Virsar Media Administation Menu</title>
    </head>
    <body>
    <table cellspacing=0 cellpadding=0>
         <td><img src="../images/title.jpg"></td>
    </table>
    <table cellspacing=0 cellpadding=0 width=800>
         <td width=20>
    <!-- <br><br><br><br><br><br><br><br><br><br> -->
         </td>
         <!-- <td width=1 bgcolor=black></td> -->
         <td>
    <h1>Subscriptions Processing Menu!</h1>
    <%-- Following code can be used to Add the record on the front end--%>
    <script language="JavaScript">
    function validate(form) {
        if (form.paymentID.value=="") {
            alert("Please fill in PaymentID");
            form.paymentName.focus();
        else if (form.clientID.value=="") {
            alert("Please fill in ClientID");
            form.clientID.focus();
        else if (form.paymentType.value=="") {
            alert("Please fill in Payment Type");
            form.paymentType.focus();
        else {
            form.submit();
    </script>
    <table cellpadding="5" border=1>
      <tr valign="bottom">
        <th>Subscription ID</th>
        <th>Client ID</th>
        <th>Client Name</th>
        <th>Subscription Type</th>
        <th>Amount</th>
        <th>Subscription Start Date</th>
        <th>Subscription Expiry Date</th>
        <th>Description</th>
        <th>State</th>
           <th>Update Subscription</th>
              <th>Delete Subscription</th>
      </tr>
    <%@ page import="business.*" %>
    <% java.util.Vector payments = (java.util.Vector)session.getAttribute("payments");
    if(payments != null){
        for (int i =0; i<payments.size(); i++){
            Payment payment = (Payment)payments.get(i);
         if(payment instanceof Payment){
            %>
            <tr valign="top">
                <td><p><%= payment.getPaymentID() %></td>
                <td><p><%= payment.getClientID() %></td>
                <td><p><%= payment.getClientName() %></td>
                <td><p><%= payment.getPaymentType() %></td>
                <td><p><%= payment.getPaymentAmount() %></td>
                <td><p><%= payment.getPaymentStartDate() %></td>
                <td><p><%= payment.getPaymentExpiryDate() %></td>
                <td><p><%= payment.getPaymentDescription() %></td>
                <td><p><%= payment.getPaymentState() %></td>
                <td><a href="../servlet/admin.ShowPaymentServlet?paymentID=<%=payment.getPaymentID()%>">Update </a></td>
                <td><a href="../servlet/admin.DeletePaymentServlet?paymentID=<%=payment.getPaymentID()%>">Delete </a></td>
            </tr>
            <%
    %>
    </table>
    <form action="../servlet/admin.AddPaymentServlet" method="get">
    <table cellspacing="5" border="0">
        <tr>
            <td align="right">Subscription ID:</td>
            <td><input type="text" name="paymentID"
                    value="">
            </td>
        </tr>
        <tr>
            <td align="right"> Client Name :</td>
            <%-- ---------------------------------------- this is where I want to set my combo -------------------- --%>
                <td>
                          <input name="clientName" type = "text" value= "../servlet/admin/ShowCompanyNames.getClientID()"></input>
                </td>
            <!--  <td><input type="text" name="clientName"
                    value="">
            </td> -->
        </tr>
        <tr>
            <td align="right"> ClientID </td>
            <td><input type="text" name="clientID"
                    value="">
            </td>
        </tr>
        <tr>
            <td align="right"> Payment Type :</td>
         <!--   <td><input type="text" name="paymentType"
                    value="">
            </td>
         -->
               <td>
                <INPUT TYPE=RADIO NAME="paymentType" VALUE="Monthly">Montly
                   <INPUT TYPE=RADIO NAME="paymentType" VALUE="Yearly">Yearly
                   <INPUT TYPE=RADIO NAME="paymentType" VALUE="One Time">One Time
                   <INPUT TYPE=RADIO NAME="paymentType" VALUE="Other">Other<br>
                  </td>
        </tr>
           <tr>
            <td align="right"> Payment Amount :</td>
            <td><input type="text" name="paymentAmount"
                    value="">
            </td>
        </tr>
           <tr>
            <td align="right"> PaymentStartDate :</td>
            <td><input type="text" name="paymentStartDate"
                    value="">
            </td>
        </tr>
           <tr>
            <td align="right"> PaymentExpiryDate :</td>
            <td><input type="text" name="paymentTelephone"
                    value="">
            </td>
        </tr>
           <tr>
            <td align="right"> Description :</td>
            <td><input type="text" name="paymentDescription"
                    value="">
            </td>
        </tr>
           <tr>
            <td align="right"> Status :</td>
            <td><input type="text" name="paymentState"
                    value="">
            </td>
        </tr>
           <td></td>
            <td><input type="button" value="Add Subscription info."
                       onClick="validate(this.form)"></td>
        </tr>
    </table>
    </form>
    <table>
    <tr>
    <td>
    <form action="Cadmin.PaymentsServlet" method="get">
        <input type="submit" value="Refresh List">
    </form>
    </td><td>
    <form action="../Admin/index.html">
        <input type="submit" value="Go Back">
    </form>
    </td>
    </table>
         </td>
    </table>
    </html>
    </body>
    </html>

  • How to add ComboBox to dynamically created DataGridColumn ?

    hai friends,
    help me, How to add ComboBox to dynamically created DataGridColumn

    public     function docfoldercurtainmanagerResult(event):void
    if(event.result){
    rightslistArray=event.result.RES2;
    //Alert.show(event.fault.message);
    <mx:DataGridColumn  
    headerText="Rights Level" minWidth="75" sortable="true" >
    <mx:itemRenderer>
    <fx:Component>
    <mx:ComboBox dataProvider="{outerDocument.rightslistArray}" labelField="sec_rights_level" />
    </fx:Component>
    </mx:itemRenderer>
    </mx:DataGridColumn>

Maybe you are looking for

  • Problem with stage and Error #1034

    Hi! Well I'm newbie in AS, writing it only for a 5 days and I've come across error which gives me a lot headache. I was searching for solution to it for quite some time now and didnt understand what I suppose to do with solution. So, here is my probl

  • How Can I run a form complied on 9ids on 10g AS

    I have installed oracle 10g AS release 2 ( 10.1.2) and 9ids release 2. when I run a form on Application server it will show me an error, i.e. The form was created by an older version.. What I can do now . Please let me know ASAP. Regards, Malay

  • Creation of RMAN Tablespace

    Hi all, Help me regarding creation of RMAN tablespace.I know that we should create RMAN Tablespace with 20gb in size by default.For creating rman tb we should execute upto catproc.sql. The question is 1)My staff taught me that we should execute upto

  • "Licensing for this product has stopped working" message appears each time I open Acrobat Pro.

    "Licensing for this product has stopped working" message appears each time I open Acrobat Pro.  I am at a loss as to how to fix the problem.  Can anyone provide some insights?

  • SAP Objects

    Hi, I like to do the changes in Standard SAP Objects  But it  does not  allow  me to do the change. Regards Rajanikanth