Hi everyone,

I have the following problem:

I supply the DropDownChoiceElement with a List containing HashMap's. So
every Listelement is a HashMap. The HashMap contains a association
between ID's and Names (the ID's are primary key whereas the Names are
not). Don't bother about the problem that then there might be duplicate
entries in the DropDownChoice.

I succesfully manage to create the html-code right, thru suppling an
IChoiceRenderer. However: how do I get the selecte Value-ID from the
DropDownChoice-Element. All I manage to get is a String containing the
Name and the ID.

Thanks for your help.
  jak4

---------------------------------
Here is the Code (it's from the examples so there isn't anything new
about it, except the HashMap):

// every Listelement contains a HashMap
List names = getListFromDB();

add(new DropDownChoice("userSelect", names, new IChoiceRenderer(){
   public String getDisplayValue(Object object) {
        return ((String)((HashMap) object).get("lastname"));
   }

   public String getIdValue(Object object, int index) {
        // avoid accessing the element -1, which is Choose Element
    if( index >= 0)
     return((Integer)((HashMap)names.get(index)).get("id")).toString();
    else
     return "-1";
   }
}));


Attachment: signature.asc
Description: OpenPGP digital signature

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to