Skip to Content
0
Sep 23, 2005 at 01:04 AM

ecpm subscribe event not working

172 Views

I am a currently working on converting my programming code from EP5 to EP6. I have not changed anything in my JSP page/javascript but for some reason my eventing is not working now.

I have 4 iviews on a page which talk to each other. I a testing them in preview mode. Based on inputting data in the first iview data is sent via EPCM to the second iview and the second iview subscribes to the event from the first iview and it works fine. However, when the second iview raises an event which is supposed to be picked up by the 3rd iview nothing happens. I believe the raise event is working in the 2nd iview as I have an alert in there and it does alert. I think the problem is that the function in the 3rd iview is never executed ...

Here are code snippets from the two jsp files that should be communicating. Any help would be greatly appreciated.

<b>JSP Code snippet from the 2nd iview to raise the event:</b>

<% // Add script to catch the event when the detail button is clicked

if(componentRequest.getValue("refreshOrderDetail")!=null){

%>

<script language="JavaScript">

// Set the variable for the order number and material

var order_material = "<%= MyJCoBean.getCurOrder() %>".concat("_").concat("<%= MyJCoBean.getMaterial() %>").concat("_").concat("<%= MyJCoBean.getActivity() %>");

EPCM.storeClientData ( 'urn:myOwnNameSpace', 'processOrderDetail', order_material);

EPCM.raiseEvent( 'urn:myOwnNameSpace', 'processOrderDetail', order_material);

alert(order_material);

</script>

<%

} // end of if block

%>

<b>Here is the code from the 3rd iview which has a function in it which is never executed because the

alert inside the function never gets executed:</b>

<script language="JavaScript">

EPCM.subscribeEvent( 'urn:myOwnNameSpace', 'processOrderDetail', <%=jsFunctionName%> );

function <%=jsFunctionName%> ( evt ) {

var eventData = evt.dataObject;

alert("I am in the funtion");

var sel_order = eventData.substring(0,eventData.indexOf("_"));

var start_pos = eventData.indexOf("_",0) + 1;

var sel_material = eventData.substring(start_pos,eventData.indexOf("_",start_pos));

var day_pos = eventData.indexOf("_",start_pos) + 1;

var end_pos = eventData.length;

var day_activity = eventData.substring(day_pos,end_pos);

alert("i am in orderdetail.jsp");

document.forms[1].order_number.value=sel_order;

document.forms[1].material.value=sel_material;

document.forms[1].days_activity.value=day_activity;

document.forms[1].submit();

}

</script>

<script language="JavaScript">

EPCM.subscribeEvent( 'urn:myOwnNameSpace', 'orderSelection', <%=jsFunctionSelect%> );

alert("orderdetail - subscribe orderSelection begin");

function <%=jsFunctionSelect%> ( evt ) {

toggleview.style.display="none";

}

</script>