0 Replies Latest reply on Sep 26, 2008 7:16 AM by Lukasz Grden

    HtmlSelectOneMenu and HtmlAjaxSupport in java code

    Lukasz Grden Newbie

      I'm having some problems with the HtmlSelectOneMenu combined with HtmlAjaxSupport. In my application, I am using method bindings so I need to create and build up the UI Components in Java code.

      I have two HtmlSelectOneMenus. The first one (let's call it type) has statically assigned items. The second one (let's call it subtype) is dynamically filled based on the selected type.

      The problem I'm having is as the type changes the subtype is not re-rendered (refilled with new values). I debugged the code and both of the comboboxes are bound properly, values and id's are set properly as well. Below you can find the Java code snippet that is supposed to re-render the second (subtype) combobox.

      HtmlSelectOneMenu comboboxType = new HtmlSelectOneMenu();
      comboboxType.setId("type");
      
      HtmlAjaxSupport ajaxSupportType = new HtmlAjaxSupport();
      comboboxType.getFacets().put("a4jsupport", ajaxSupportType);
      
      HtmlSelectOneMenu comboboxSubType = new HtmlSelectOneMenu();
      comboboxSubType.setId("subtype");
      
      // value expressions are not shown...
      
      ajaxSupportType.setEvent("onchange");
      ajaxSupportType.setReRender(comboboxSubType.getClientIdFacesContext.getCurrentInstance()));
      ajaxSupportType.setAjaxSingle(true);
      


      Would anyone see/know what the problem is and suggest a solution?

      Thank you for the reply.