try:

Option[selected].setSelected(true);

I think this is how I do it....

I usually create the Select first, then use .addElement to add each new
option.
Something like this:

dropDown.addElement(new Option(selectField).setSelected(true));


                                                                                       
                                                
                      Jean-Francois LE                                                 
                                                
                      BERRE                    To:       [EMAIL PROTECTED]             
                                      
                      <[EMAIL PROTECTED]>         cc:                                  
                                                   
                                               Subject:  Method selectOption from 
Select                                               
                      03/29/2004 09:53                                                 
                                                
                      PM                                                               
                                                
                      Please respond to                                                
                                                
                      "ECS Users List"                                                 
                                                
                                                                                       
                                                
                                                                                       
                                                




Hi,

Method selectOption from Select seems not to work...

My code is the following:

    Option[] types = {      new Option("user_auth", "user_auth",
"Utilisateur authentifié"),
      new Option("moderator", "moderator", "Modérateur"),
      new Option("administrator", "administrator", "Administrateur")
    };
    int selected = 0;
    int t = userToModify.getType();
    if(t == IType.USER_AUTH)
      selected = 0;
    else if(t == IType.MODERATOR)
      selected = 1;
    else if(t == IType.ADMINISTRATOR)
      selected = 2;
    // I checked: here t is 2 in my example
    Select typesOption = new Select("type", types);
    typesOption.selectOption(selected);

But when displaying HTML page, no item is selected in the Select form.
I checked HTML source code too...

What am I doing wrong?

I'm using this archive:
http://apache.mirror.cygnal.ca/jakarta/ecs/binaries/ecs-1.4.2.tar.gz

Thanks
Jean-François

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to