5 Replies Latest reply on Aug 22, 2008 4:13 AM by Boris Jmailov

    dynamic create inputText in portlet.

    Boris Jmailov Newbie

      Hi all!
      JBoss portal application.
      I am create dynamic collections inputText and add on rich:modalPane.
      After input value in pane i do not get this value in bean. Binding this component from bean variable inpossible. What can i do?

        • 1. Re: dynamic create inputText in portlet.
          shadowcreeper Apprentice

           

          <h:inputText value="#{bean.value}" onchange="updateBeanValue(this.value);"/>
          
          <a4j:jsFunction name="updateBeanValue" oncomplete="doCalculation();">
           <a4j:actionparam name="beanValue" assignTo="#{bean.value}"/>
          </a4j:jsFunction>
          
          <!-- We have to split this up due to a bug in Facelets wrt actionListeners with actionparams -->
          <a4j:jsFunction name="doCalculation" actionListener="#{bean.actionToExecute}" reRender="componentToReRender"/>
          


          • 2. Re: dynamic create inputText in portlet.
            Boris Jmailov Newbie

            I am create this component incode bean dynamical

            • 3. Re: dynamic create inputText in portlet.
              Boris Jmailov Newbie

              This not work.
              In bean code:
              HtmlInputText key = new HtmlInputText();
              key.setValue(param.getKey());
              key.setOnchange("updateBeanValue(this.value);");
              uic1.getChildren().add(key);
              in xhtml :
              <h:panelGrid id="lspar" columns="2" styleClass="resultGrid"
              rowClasses="even-row, odd-row"
              >


              <a4j:jsFunction name="updateBeanValue" immediate="true" ajaxSingle="true" oncomplete="doCalculation();">
              <a4j:actionparam name="beanValue" assignTo="#{links.tmpIn}"/>
              </a4j:jsFunction>

              <a4j:jsFunction name="doCalculation" immediate="true" ajaxSingle="true" actionListener="#{links.inputText}"/>
              </h:panelGrid>

              • 4. Re: dynamic create inputText in portlet.
                Boris Jmailov Newbie

                Problem! I can not get id componenta from xhtml, but in jsp page i can get id componenta:
                in xhtml:
                <a4j:jsFunction name="updateBeanValue" immediate="true" ajaxSingle="true" oncomplete="doCalculation();">
                <a4j:actionparam name="beanValue" assignTo="#{links.tmpIn}"/>
                <a4j:actionparam name="compId" assignTo="#{links.tmpId}"/>
                </a4j:jsFunction>
                <a4j:jsFunction name="doCalculation" actionListener="#{links.inputText}" immediate="true" ajaxSingle="true" />

                In bean
                HtmlInputText key = new HtmlInputText();
                key.setValue(param.getKey());
                key.setOnchange("updateBeanValue(this.value,this.id);");
                uic1.getChildren().add(key);
                }
                public void inputText(ActionEvent e){
                log.info("***"+e.getComponent());
                log.info("Val-----"+this.getTmpIn()); // real value from page
                log.info(" ID-----"+this.getTmpId());// !!!!! Id is empty!!!!!

                }

                • 5. Re: dynamic create inputText in portlet.
                  Boris Jmailov Newbie

                  Yes!!! I am solved problem!
                  in bean:
                  HtmlInputText key = new HtmlInputText();
                  key.setValue(param.getKey());
                  key.setOnchange("updateBeanValue(this.value,this.name);");
                  uic1.getChildren().add(key);
                  public void inputText(ActionEvent e) {
                  String ids = this.getTmpId();
                  ids = ids.substring(ids.lastIndexOf(":"));
                  ((HtmlInputText)FacesContext.getCurrentInstance().getViewRoot().findComponent("main"+ids)).setValue(this.getTmpIn());

                  }
                  in xhtml:
                  <a4j:jsFunction name="updateBeanValue" immediate="true" ajaxSingle="true" oncomplete="doCalculation();">
                  <a4j:actionparam name="beanValue" assignTo="#{links.tmpIn}"/>
                  <a4j:actionparam name="compId" assignTo="#{links.tmpId}"/>
                  </a4j:jsFunction>
                  <a4j:jsFunction name="doCalculation" actionListener="#{links.inputText}" immediate="true" ajaxSingle="true" />