Drop Down List - setSelected from Database
Hi there!
I added a drop-down list: cboActive onto a page. I use the "configure default options" to add to options: 1) Active.. Value 1.. 2)Non Active.. Value 0.
I can save it to the Database it works fine.
I then do this in the prerender to read the values...
When I try to read it from the database... the following line shows the CORRECT value in the message box:
info("Here: " + stock_stockUpdateDataProvider1.getValue("Active"));
BUT
When I try to set the value, it doesn't set it:
String sVal = (String) stock_stockUpdateDataProvider1.getValue("Active");
cboActive.setSelected(sVal);
Doesn't work....
cboActive.setSelected(stock_stockUpdateDataProvider1.getValue("Active"));
Also doesnt work...
Here's the whole code for that section...
public void prerender() {
//cboGroupID.setSelected(new Integer(0)); //Default to be N/A
try {
getSessionBean1().getStock_stockUpdateRowSet1().setObject(1, getSessionBean1().getStockID());
stock_stockUpdateDataProvider1.refresh();
info("Here: " + stock_stockUpdateDataProvider1.getValue("Active"));
txtPackSize.setValue((Double) stock_stockUpdateDataProvider1.getValue("PackSize"));
String sVal = (String) stock_stockUpdateDataProvider1.getValue("Active");
cboActive.setSelected(sVal);
} catch (Exception ex) {
log("Error Description", ex);
}
}
Please help me - thanks

