-
1. Re: redirect from a rich:modalPanel a4j:commandButton
ilya_shaikovsky Jun 15, 2010 5:45 AM (in response to mthaxmiller)show complete page sources. and information from server console when clicking at action button.
-
2. Re: redirect from a rich:modalPanel a4j:commandButton
mthaxmiller Jun 16, 2010 4:25 PM (in response to ilya_shaikovsky)The idea is to click on the commandLink which opens a modal panel. Then the user can click on the "Reopen" button on the modal panel and be redirected to the interview.
Here is the facelet - dccchecklist.xhtml (I have simplified it to better explain the problem):
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
xmlns:custom="http://doc/jsf/custom"
template="pagetemplate.xhtml">
<ui:define name="content">
<h:form id="dccchecklistform">
<rich:panel id="dccchecklistprocpanel" style="width: 100%; height: 500px;">
<rich:dataTable headerClass="dr-table-header" width="96%" id="taskList" value="#{IntakeOffenderBean.DCCTasks}" var="dccChkTaskBean">
<rich:column id="taskName" width="170px">
<f:facet name="header"><h:outputText value="Task Description" styleClass="stdLabelLight"/></f:facet>
<a4j:commandLink limitToList="true" oncomplete="javascript:Richfaces.showModalPanel('genericmp',{width:500, height: 260, top:200});" styleClass="linkText" value="#{dccChkTaskBean.task.task.description}"/>
</rich:column>
</rich:dataTable>
</rich:panel>
</h:form>
<rich:modalPanel id="genericmp" minHeight="240" minWidth="450" zindex="2000">
<a4j:log popup="false"/>
<f:facet name="header">
<a4j:outputPanel id="mpheader">
<h:outputText value="Reopen Interview"/>
</a4j:outputPanel>
</f:facet>
<table width="100%" align="center">
<tr>
<td colspan="2" align="center">
<h:outputText value="Inteview is already completed. Press Reopen if you to want to reopen the interview and make further changes or press Cancel to leave the interview closed." styleClass="stdLabel"/>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<a4j:commandButton styleClass="stdButton" status="majorstatus" id="reopenButton" value="Reopen" limitToList="true"
action="reopen"/>
</td>
</tr>
</table>
</rich:modalPanel>
</ui:define>
</ui:composition>Here is the output form a4j:log (after you click the "Reopen" button):
debug[16:21:09,718]: Have Event [object Object] with properties: target: undefined, srcElement: [object], type: clickdebug[16:21:09,718]: Query preparation for form 'null' requestedAgain, here is the faces-config info:<navigation-rule>
<from-view-id>dccchecklist.xhtml</from-view-id>
<navigation-case>
<from-outcome>reopen</from-outcome>
<to-view-id>/pages/dccbasicsinterview.xhtml</to-view-id>
<redirect/>
</navigation-case>
</navigation-rule>richfaces 3.3.1Any ideas on what the problem might be? Thanks for taking a look. -
3. Re: redirect from a rich:modalPanel a4j:commandButton
ilya_shaikovsky Jun 17, 2010 5:53 AM (in response to mthaxmiller)from log:
debug[16:21:09,718]: Query preparation for form 'null' requested
and from your page code I see that you forgot to wrap command control with form.
-
4. Re: redirect from a rich:modalPanel a4j:commandButton
mthaxmiller Jun 17, 2010 8:44 AM (in response to ilya_shaikovsky)Thanks for your response. After adding the form, I am getting more information in the log but the action is still not redirecting to the new page. Here is the new log information:
debug[8:41:22,203]: Have Event [object Object] with properties: target: undefined, srcElement: [object], type: clickdebug[8:41:22,218]: Query preparation for form 'reopenform' requesteddebug[8:41:22,218]: Append hidden control reopenform with value [reopenform] and value attribute [reopenform]debug[8:41:22,234]: Append hidden control reopenform:genericmpOpenedState with value [] and value attribute []debug[8:41:22,234]: Append hidden control javax.faces.ViewState with value [j_id2] and value attribute [j_id2]debug[8:41:22,234]: parameter reopenform:reopenButton with value reopenform:reopenButtondebug[8:41:22,250]: Look up queue with default namedebug[8:41:22,250]: NEW AJAX REQUEST !!! with form: reopenformdebug[8:41:22,265]: Start XmlHttpRequestdebug[8:41:22,265]: Reqest state : 1debug[8:41:22,265]: QueryString: AJAXREQUEST=_viewRoot&reopenform=reopenform&reopenform%3AgenericmpOpenedState=&javax.faces.ViewState=j_id2&reopenform%3AreopenButton=reopenform%3AreopenButton&debug[8:41:22,328]: Reqest state : 2debug[8:41:22,328]: Reqest state : 3debug[8:41:22,328]: Reqest state : 4debug[8:41:22,343]: Reqest end with state 4debug[8:41:22,343]: Response with content-type: text/xml;charset=UTF-8debug[8:41:22,343]: Full response content: <?xml version="1.0"?><html xmlns="http://www.w3.org/1999/xhtml"><head><meta name="Ajax-Update-Ids" content="" /><title></title></head><body><span id="ajax-view-state"><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="j_id2" /></span><meta id="Ajax-Response" name="Ajax-Response" content="true" /></body></html>debug[8:41:22,359]: Header Ajax-Expired not found, search in <meta>debug[8:41:22,359]: search for elements by name 'meta' in element #documentdebug[8:41:22,359]: Find <meta name='Ajax-Update-Ids' content=''>debug[8:41:22,375]: Find <meta name='Ajax-Response' content='true'>debug[8:41:22,375]: Header Ajax-Update-Ids not found, search in <meta>debug[8:41:22,375]: search for elements by name 'meta' in element #documentdebug[8:41:22,390]: Find <meta name='Ajax-Update-Ids' content=''>warn[8:41:22,390]: No information in response about elements to replacedebug[8:41:22,390]: call selectSingleNode for id= org.ajax4jsf.oncompletedebug[8:41:22,390]: Processing updates finished, no oncomplete function to calldebug[8:41:22,406]: call selectSingleNode for id= ajax-view-statedebug[8:41:22,406]: Hidden JSF state fields:debug[8:41:22,406]: Namespace for hidden view-state input fields is undefineddebug[8:41:22,406]: search for elements by name 'input' in element spandebug[8:41:22,421]: Replace value for inputs: 10 by new values: 1debug[8:41:22,421]: Input in response: javax.faces.ViewStatedebug[8:41:22,421]: Found same input on page with type: hiddendebug[8:41:22,437]: Found same input on page with type: hiddendebug[8:41:22,437]: Found same input on page with type: hiddendebug[8:41:22,437]: search for elements by name 'INPUT' in element spandebug[8:41:22,453]: Replace value for inputs: 10 by new values: 0debug[8:41:22,453]: call selectSingleNode for id= _A4J.AJAX.focusdebug[8:41:22,453]: No focus information in responseAnd here is the updated facelet:<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
xmlns:custom="http://doc/jsf/custom"
template="pagetemplate.xhtml">
<ui:define name="content">
<h:form id="dccchecklistform">
<rich:panel id="dccchecklistprocpanel" style="width: 100%; height: 500px;">
<rich:dataTable headerClass="dr-table-header" width="96%" id="taskList" value="#{IntakeOffenderBean.DCCTasks}" var="dccChkTaskBean">
<rich:column id="taskName" width="170px">
<f:facet name="header"><h:outputText value="Task Description" styleClass="stdLabelLight"/></f:facet>
<a4j:commandLink limitToList="true" oncomplete="javascript:Richfaces.showModalPanel('genericmp',{width:500, height: 260, top:200});" styleClass="linkText" value="#{dccChkTaskBean.task.task.description}"/>
</rich:column>
</rich:dataTable>
</rich:panel>
</h:form>
<h:form id="reopenform">
<rich:modalPanel id="genericmp" minHeight="240" minWidth="450" zindex="2000">
<a4j:log/>
<f:facet name="header">
<a4j:outputPanel id="mpheader">
<h:outputText value="Reopen Interview"/>
</a4j:outputPanel>
</f:facet>
<table width="100%" align="center">
<tr>
<td colspan="2" align="center">
<h:outputText value="Interview Task has been marked completed for #{IntakeOffenderBean.offender.offenderName} (#{IntakeOffenderBean.offender.offenderId}) by #{IntakeConfirmTaskBean.selectedTask.task.confirmStaff}" styleClass="stdLabel"/>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<h:outputText value="Inteview is already completed. Press Reopen if you to want to reopen the interview and make further changes or press Cancel to leave the interview closed." styleClass="stdLabel"/>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<a4j:commandButton styleClass="stdButton" status="majorstatus" id="reopenButton" value="Reopen" limitToList="true"
action="reopen"/>
</td>
</tr>
</table>
</rich:modalPanel>
</h:form>
</ui:define>
</ui:composition>Thanks again! -
5. Re: redirect from a rich:modalPanel a4j:commandButton
ilya_shaikovsky Jun 18, 2010 4:47 AM (in response to mthaxmiller)seems we missing something obvious.. please attach sample war (or zipped project) to thread. I will review and correct it.
-
6. Re: redirect from a rich:modalPanel a4j:commandButton
mthaxmiller Jun 18, 2010 4:44 PM (in response to ilya_shaikovsky)You are absolutely correct, it was something obvious. A mistyped the name of the facelet in to-view-id. But I am so happy to now have a working example of how to redirect to a new page from a modal panel. Thanks for all your help!