rich:modalpanel will not show more than when invoked from form
I have a problem with showing a <rich:modalPanel>
more than once.
I have a form that has a <a4j:commandlink onclick="#{rich:component('mp')}.show()"
(have also tried a rich:componentControl
).
This approach works fine once. Inside the modal panel I have a new form with some action attached to the submit button(a4j:commandButton
). When this action completes the modalpanel is hidden using the same approach as above with oncomplete="#{rich:component('mp')}.hide()"
, and the form containing the commandlink is reRendered.
Now, the problem is that the commandLink for showing the modalpanel does no longer work. If I put in an js alert('something')
in the onclick
event I can se that the onclick
event is fired, but the modalpanel is not rendered.
Hope this is enough information...I can add some source code later if needed
Thanks
edit: here's some more code:
<a4j:form prependId="false" ajaxSubmit="true">
<a4j:outputPanel id="createActivityPanel">
<h:panelGrid columns ="2">
<h:outputLabel value="#{msg.createActivityExpectedParticipantsLabel}" />
<h:panelGrid columns ="2">
<h:outputLabel value="#{msg.createActivityAvailablePointsLabel}: #{sessionBean.loggedInUser.letspoints}" />
<a4j:commandLink value="#{msg.createActivityGetMorePointsLinkLabel}" onclick="#{rich:component('convertPointsPanel')}.show()" />
<rich:inputNumberSlider id="participantsSlider" value="#{activityRequestBean.newActivityExpectedNoParticipants}" maxValue="#{activityRequestBean.maxNoParticipants}" />
</h:panelGrid>
</h:panelGrid>
</a4j:outputPanel>
</a4j:form>
<rich:modalPanel rendered="#{sessionBean.loggedIn}" id="convertPointsPanel" width="700" height="400">
<a4j:support event="onhide" reRender="createActivityPanel"></a4j:support>
<f:facet name="header">
<h:outputText value="Velg poeng fra kategorier for å konvertere" />
</f:facet>
<f:facet name="controls">
<a4j:form><a4j:commandButton id="closeButton" onclick="#{rich:component('convertPointsPanel')}.hide()" type="image" image="/img/close.gif"/></a4j:form>
</f:facet>
<a4j:form prependId="false" ajaxSubmit="true" id="convertPointsForm">
<h:panelGrid columns ="2">
<h:panelGroup layout="block" style="width:350px; float:left;">
<rich:dataList var="catscore" value="#{pointsRequestBean.scores}" id="activityPointSliderList">
<h:graphicImage height="30" width="30" value="#{catscore.usercategoryscore.category.imagepath}" />
<h:outputText value="#{catscore.usercategoryscore.category.name}" />
<rich:inputNumberSlider maxValue="#{catscore.usercategoryscore.score}" value="#{catscore.transferredScore}" step="2" />
</rich:dataList>
<a4j:commandButton value="Konverter" id="convertButton" action="#{pointsRequestBean.convertPoints}" oncomplete="#{rich:component('convertPointsPanel')}.hide()" reRender="createActivityPanel"/>
</h:panelGroup>
<h:panelGroup layout="block" style="width:350px; float:right; border-left: 1px solid #ACBECE; padding: 10px;">
<h:outputText value="kjøp poeng fra paypal?" />
</h:开发者_开发知识库panelGroup>
</h:panelGrid>
</a4j:form>
</rich:modalPanel>
Notice that I've followed the advice in rerendering the panel instead of the form.
Could you post the XHTML code?
Basically, one of your problem may be due to the fact that you reRender a form. Generally, it's not a good idea. One solution is to include a <a4j:outputPanel>
and then re-render this panel instead of the form itself.
So instead of having:
<a4j:commandButton ... reRender="myForm"/>
<h:form id="myForm">
...
</h:form>
you can do:
<a4j:commandButton ... reRender="myFormContent"/>
<h:form id="myForm">
<a4j:outputPanel id="myFormContent">
...
</a4j:outputPanel>
</h:form>
If this does not work, please add more code in your question.
精彩评论