Note that there are some explanatory texts on larger screens.

plurals
  1. POJSF Dynamic Rendered Component's Value becomes null when the form is submitted
    primarykey
    data
    text
    <p>I have a JSF page which renders a text field depending on the value of a drop down using primefaces ajax listner. The dynamic rendering is done fine. but the problem is once I submit the form the the bound value of that textfield doesn't get bound instead it is shown as null.</p> <p>this is the part of my JSF only the necessary fields are included here</p> <pre><code>&lt;h:panelGroup id="textPanel" &gt; &lt;h:form id="main" prependId="false"&gt; &lt;h:outputText value="WorkFlow ID:" /&gt; &lt;h:selectOneMenu id="workFlows" value="#{workFlowSelectionController.selectedWorkFlowId}" &gt; &lt;p:ajax event="change" listener="#{workFlowSelectionController.dropDownChange}" update="textPanel"/&gt; &lt;f:selectItems value="#{workFlowSelectionController.allActiveworkFlows}"/&gt; &lt;/h:selectOneMenu&gt; &lt;p:inputText value="#{workFlowSelectionController.texField}" rendered="#{workFlowSelectionController.textfieldVisibility}"/&gt; &lt;p:commandButton ajax="false" value="Next" action="#{workFlowSelectionController.addWorkFlowselectionDetails}"/&gt; &lt;/h:form&gt; &lt;/h:panelGroup&gt; </code></pre> <p>this is my managed bean</p> <pre><code>@ManagedBean @RequestScoped public class WorkFlowSelectionController { private boolean textfieldVisibility = false; private String texField; public void dropDownChange() { logger.info("WorkFlowSelectionController.dropDownChange() entered"); if (selectedWorkFlowId != null) { if (selectedWorkFlowId.equals("-1")) { textfieldVisibility = true; operationListStatus = false; } else { textfieldVisibility = false; operationListStatus = true; } } else { textfieldVisibility = false; operationListStatus = true; } public void addWorkFlowselectionDetails() throws CloneNotSupportedException { System.out.println("Selected Value of Text Field is" + texField); } public String getTexField() { return texField; } public void setTexField(String texField) { this.texField = texField; } } </code></pre> <p>i haven't included the dropdown code of the backing bean. i just need an idea of what i am doing wrong here if i remove the rendered attribute of the textfield it works fine.</p> <p>thank you</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload