Title: HtmlSelectOneMenu valueChange behavior
Sorry, I meant to say that calling this.getReportName() in the buidControl() listener returns null whereas event.getNewValue() works.
Simeon


From: Leyzerzon, Simeon [mailto:[EMAIL PROTECTED]
Sent: Monday, September 11, 2006 12:21 PM
To: '[email protected]'
Subject: HtmlSelectOneMenu valueChange behavior

Hi,
I have the following code in my application, and it works, but I'm wondering if this is the right way to do it:

public HtmlPanelGrid getPanelGrid() {
       
        grid = new HtmlPanelGrid();
        grid.setColumns(4);
        grid.setBgcolor("red");

        HtmlSelectOneMenu chooser = new HtmlSelectOneMenu();
        chooser.setId("reportsOfCategory");
        chooser.setOnchange("submit()");
        chooser.setValue("${selector.reportName}");
        chooser.setValueChangeListener(application.createMethodBinding(
                "#{selector.buildControls}",
                new Class[] { ValueChangeEvent.class}));
        chooser.setTitle("Please select a report to run");
        chooser.getChildren().add(ReportsPerCategoryMapper.getOptionItems(this.getCategory().getName()));
       
        grid.getChildren().add(chooser);
        //this is only for testing
        grid.getChildren().add(displayCategory());
        return grid;
    }
   
    public void buildControls(ValueChangeEvent event) {
        System.out.println("I got the report's name: " + event.getNewValue());
    }


Calling chooser.getValue() in the listener method returns null, whereas event.getNewValue() works.  Could someone please explan this behavior.  What is the purpose of chooser.setValue() if getting the value doesn't work?  Would it be correct to do:

                reportName = event.getNewValue();

or is there a better way?

TIA.

Simeon Leyzerzon
Risk IT
<<...OLE_Obj...>>
     
Tel: 212-538-7518
Profile <http://people.csfb.net/from_gtd.asp?gtdid=1160763>


==============================================================================
Please access the attached hyperlink for an important electronic communications disclaimer: 

http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
==============================================================================

==============================================================================
Please access the attached hyperlink for an important electronic communications disclaimer: 

http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
==============================================================================

Reply via email to