Topic
No replies
vickyb20
vickyb20
1 Post
ACCEPTED ANSWER

Pinned topic IDM jsf ajax Strang behaviour

‏2012-08-06T17:51:48Z |
HI All,

I am facing this interesting issue where ajax works first time and never works again unless u refresh the page... below is my code
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib uri="http://www.ibm.com/jsf/html_extended" prefix="hx"%>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="/WEB-INF/lib/tld/ibm-portlet-ext-v60.tld" prefix="portletExtV60"%>
<%@ page language="java" contentType="text/html" pageEncoding="ISO-8859-1" session="false"%>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>
<%@taglib uri="/WEB-INF/tld/treenavigation.tld" prefix="ex"%>
<portlet:defineObjects />
<f:loadBundle var="brkSupport" basename="com.chartis.gp.support.nl.BrokerSupportPortletResource"/>
<portlet:resourceURL var="brokersupporturl" id="faq" escapeXml="false" />
<portlet:resourceURL var="enquiryurl" id="enquiry" escapeXml="false" />
<portlet:resourceURL var="contentErrorURL" id="noContent" escapeXml="false" >
<portlet:param name="ERROR_CODE" value="noContent" />
</portlet:resourceURL>
<script type="text/javascript">
function hello(){
// dojo.style(dojo.byId("loading"),"display","block");

}

function complete(){
alert(" complere ");
//dojo.style(dojo.byId("contactChartisSupportMainForm"),"display","block");
// dojo.style(dojo.byId("loading"),"display","none");
}

function mailCompetion(){
document.getElementById("brokSuppBlackOverlay").style.display ='none';
dojo.style(dojo.byId("contactChartisSupportMainForm"),"display","none");
dojo.style(dojo.byId("contactChartisTechnical"),"display","block");
dojo.byId("techFaqContent").innerHTML=dojo.byId("mailMsg").innerHTML ;
dojo.style(dojo.byId("mailMsg"),"display","block");
}
function displayContactChartis(key){
switch (key) {
case 'W':
document.getElementById("brokSuppBlackOverlay").style.zIndex = 1000;
break;
default:
break;
}
}
</script>
<f:view>
<hx:scriptCollector id="scrptCol">
<h:form styleClass="niceform" id="chartisSupportPopUpForm">

<h:panelGroup id="charSuppPopUpTitle"></h:panelGroup>

**Send an Enquiry**

<h:panelGroup id="displayFOrmName"></h:panelGroup>

<h:panelGroup id="productLineView" styleClass="generalCSSform" >
  • <h:outputText value="#{pc_BrokerSupportView.checkName}" />*
</h:panelGroup>
<input type="button" class="submitCCS" onclick="sendMailInvoke()" />
<input type="button" value="cancel" onclick="closeForm()" />

<hx:ajaxRefreshSubmit onstart="hello();" onerror="error(this, event);" id="ajaxrefershsubmit" oncomplete="complete();" target="productLineView" ></hx:ajaxRefreshSubmit>

<hx:ajaxRefreshSubmit onstart="displayContactChartis('W');" onerror="error(this, event);" id="ajaxrefershsubmit2" oncomplete="mailCompetion();" target="mailSentDisp" ></hx:ajaxRefreshSubmit>
<input type="hidden" id="brokersupportsr" value="<%=renderResponse.encodeURL(brokersupporturl.toString())%>">
<input type="hidden" id="enquiryurl" value="<%=renderResponse.encodeURL(enquiryurl.toString())%>">
<input type="hidden" id="TCMID" name="TCMID" value="">
<input type="hidden" id="viewrender" value="view<%=renderResponse.getNamespace()%>:chartisSupportPopUpForm:prodsNservicesBtn">
<hx:commandExButton action="#{pc_BrokerSupportView.getEnquiryFormContents}" value="hellotest" style="display:none;" id="prodsNservicesBtn">
<hx:behavior event="onclick" behaviorAction="get" targetAction="productLineView" id="behavior1" ></hx:behavior>
</hx:commandExButton>
<hx:commandExButton action="#{pc_BrokerSupportView.getFormContent}" value="hellotest" style="display:none;" id="sendMail">
<hx:behavior event="onclick" behaviorAction="get" targetAction="mailSentDisp" id="behavior2" ></hx:behavior>
</hx:commandExButton>
</h:form>

</hx:scriptCollector>
</f:view>
I have higlighted the lines which matter when click on link it make an ajax call and clicks a button which calls a managed bean method and updates a panel .. it works first time second time it fails.. from then on it fails unless i refersh the page.. please help