0 Replies Latest reply on Aug 1, 2007 3:39 AM by Alexander Furer

    Add hidden input dynamically

    Alexander Furer Newbie

      I'm trying to add hidden input to page dynamically.
      The code is executed in the actionListener, wich is fired from link:

      <h:commandLink id="editBuilding" action="editBuilding" onclick="openPopup(window,'editBuildingWnd','../',120)" target="editBuildingWnd" actionListener="#{buildingBean.selectObject}">

      in the action listener of buildingBean:
      public void selectObject(ActionEvent event){
       UIComponent body = FacesContext.getCurrentInstance().getViewRoot().findComponent("bodyTD");
       HtmlInputHidden id = new HtmlInputHidden();
       ValueBinding vb = FacesContext.getCurrentInstance().getApplication().createValueBinding("#{buildingBean.objId}");

      and the structure of jsp the request is forwarded to is :
      <h:form id="popupForm" enctype="multipart/form-data" style="margin:0px; padding:0px" >
      <t:htmlTag value="td" id="bodyTD" forceId="true" >

      I have few problems here :
      1. I get null when i try to find form component like this:
      UIComponent body = FacesContext.getCurrentInstance().getViewRoot().findComponent("popupForm");
      2. Then i decided to add hidden input to td (bodyTD), it's found , but i don't see hidden input is rendered in html.
      Please advise