Note that there are some explanatory texts on larger screens.

plurals
  1. POrendering values of multiple select boxes in a JSF form
    primarykey
    data
    text
    <p>Hi so in my JSF form I have three select boxes.This is the code:</p> <pre><code>&lt;h:form id="newRequestForm"&gt; &lt;h1&gt;New Request&lt;/h1&gt; &lt;br/&gt; &lt;h:panelGrid columns="4"&gt; &lt;h:selectOneMenu id="issueID" style="margin-left: 3px;" value="#{mycontroller.requestType}"&gt; --few items---- &lt;f:ajax event="change" listener="#{mycontroller.changeTypeList}" render="selectDevice" execute="@this" /&gt; &lt;/h:selectOneMenu&gt; &lt;br/&gt; &lt;div id="sessionDiv" columns="2"&gt; &lt;h:selectOneMenu id="selectRole" style="margin-left: 29px;" value="#{mycontroller.roleID}"&gt; &lt;f:selectItems value="#{mycontroller.roleList}" itemValue="#{mycontroller.roleList}"/&gt; &lt;/h:selectOneMenu&gt; &lt;/div&gt; &lt;div id="deviceDiv" columns="2"&gt; &lt;h:selectOneMenu id="selectDevice" style="margin-left: 18px;" value="#{mycontroller.userId}"&gt; &lt;f:selectItems value="#{mycontroller.deviceList}" var="device" itemValue="#{device.deviceId}"/&gt; &lt;/h:selectOneMenu&gt; &lt;/div&gt; &lt;div id="userDiv" columns="2"&gt; &lt;h:selectOneMenu id="selectUser" style="margin-left: 50px;" value="#{mycontroller.userIdReq}"&gt; &lt;f:selectItems value="#{mycontroller.usersList}" var="user" itemValue="#{user.userId}"/&gt; &lt;/h:selectOneMenu&gt; &lt;/div&gt; &lt;br/&gt; &lt;br/&gt; &lt;h:commandButton action="#{requestSupportController.submitRequest}" value="Submit Request" style="margin-top: 20px"/&gt; &lt;/h:form&gt; </code></pre> <p>Now when the form first loads the last three divs are hidden and based on the drop down values of the first div the reminaing divs are shown.Now in my ajax event I use render="selectDevice" which populates the values in that drop down.</p> <p>I actually have three scenarios: a)If the selected item in the first div is "Roles" all the roleId should be populated in the second div b)If the selected item in the first div is "Device" all the deviceID should be populated in the third div c)If the selected item in the first div is "Users" all the userIDshould be populated in the fourth div</p> <p>How can i achieve this as render can only render one div.When i used render="@form" then all divs are shown instead of being hidden.</p>
    singulars
    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.
    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