0
I have a Selectonemenu in my xhtml view. I have an onchange in it that when clicking calls a p:dialog to fill out a form. Follow selectOneMenu
<p:column headerText="Mecânica">
<div id="mecanicasAll">
<p:selectOneMenu onchange="PF('cadastraMecanica').show();"
id="mecanica" rendered="#{document.type == 'Pergunta'}"
value="#{bancoPerguntasMBean.mecanicas}" effect="fold">
<f:selectItem itemLabel="Selecione a mecânica"
noSelectionOption="true" />
<f:selectItems value="#{bancoPerguntasMBean.mecanicas}" />
</p:selectOneMenu>
</div>
</p:column>
p:dialog I have it here
<h:form id="cadastraMecanica">
<p:dialog style="text-align: center" header="Cadastrar Mecânica"
widgetVar="cadastraMecanica" resizable="false" modal="true"
width="1050" height="630">
<c:if test="#{bancoPerguntasMBean.mecanicas == 'QUIZ'}">
<ui:include src="bancoPerguntasQuestaoQuiz.xhtml" />
</c:if>
<c:if test="#{bancoPerguntasMBean.mecanicas == 'VERDADEIROFALSO'}">
<ui:include src="bancoPerguntasQuestaoVerdadeiroFalso.xhtml" />
</c:if>
<c:if test="#{bancoPerguntasMBean.mecanicas == 'DESCRITIVA'}">
<ui:include src="bancoPerguntasQuestaoDescritiva.xhtml" />
</c:if>
<c:if test="#{bancoPerguntasMBean.mecanicas == 'ASSOCIACAO'}">
<ui:include src="bancoPerguntasQuestaoAssociacao.xhtml" />
</c:if>
<c:if test="#{bancoPerguntasMBean.mecanicas == 'ARRASTASOLTA'}">
<ui:include src="bancoPerguntasQuestaoArrastaSolta.xhtml" />
</c:if>
</p:dialog>
</h:form>
What I really need is that depending on the value that is selected in the Selectonemenu it does the include of the file referring to the selected.
Someone to help with that logic?
JSTL with primefaces doesn’t usually work well, you tried with an outputPane tag using the rendered property?
– Giuliana Bezerra
Ola Giuliana, thanks for the reply, I thought better and changed to outputpanel. However my doubt is on how to redeem the value selected by the user in selectOneMenu, understand. Clicking on the value will open the p:dialog, but before opening I need to send the selected value to the Bean, in order to render?
– Michael Soares