2 Replies Latest reply on Apr 9, 2009 6:36 AM by Arbi Sookazian

    combobox + inputTextBox rerendering problem

    martin vich Newbie

      I would like to have inputTextArea with content which will be according to choosen item in combobox. My problem is that selectedText is not setted from combobox, so thre is nothing in inputTextArea :(


      TextLoader bean :


       
      @Stateful
      public class TextLoader implements TextLoaderLocalIF, Serializable {
        @DataModel  
        private List<Text> texts = new ArrayList<Text>(0);
        
        private Text selectedText = new Text(); //do not want null pointer exception
      
      and getters/setters
      }
      



      Text entity :


      @Entity
      @Name("text")
      public class Text {
      
      String name;
      String content;
      .
      .getters,setters
      .
      }




      Form :




      <h:form id="textForm">
                     
      <h:selectOneMenu value="#{textLoader.selectedText}">
        <s:selectItems value="#{texts}" var="selected" label="#{selected.name}" />
        <a:support event="onchange" reRender="textForm"/>
        <s:convertEntity/>
      </h:selectOneMenu>
                          
      <h:inputTextarea rows="10" cols="50" id="textContent" value="#{textLoader.selectedText.content}" />
      
      <a:commandButton action="#{textLoader.modify(textLoader.selectedText)}" value="Save text"/>
      
      </h:form>