In my JSF 1.2 application, I'm using trinidad extended service addscript functionality to invoke a javascript function.
I can see from the following javascript console logs that js method is being called. But POST request is not being generated. There're many other(normal)buttons in the page which are working without any issues. There are no JS errors in my console. I've ensured that all my included pages don't have any forms and this is the only form.
And my biggest headache is, it is working fine in my local workspace and I've problems only while hitting my application URL directly. This is happening across all IE versions.
Can someone suggest what could be the issue?
In Bean:
FacesContext facesContext = FacesContext.getCurrentInstance();
ExtendedRenderKitService service = Service.getRenderKitService(
facesContext, ExtendedRenderKitService.class);
service.addScript(facesContext, “clickHiddenButton();”);
Javascript:
function clickHiddenButton () {
if(null != console)
console.log('before calling hidden button for close');
document.getElementById('hiddenButton').click();
if(null != console)
console.log('after calling hidden button for close');
}
My Page Hidden Button Component:
<tr:commandButton id="hiddenButton" action="#{bean.actionHidden}" immediate="true"></tr:commandButton>
It's working after I made the method pause for 500 milliseconds before clicking the hidden button by the following code. Probably, this is not the right approach(that's why I haven't accepted this answer). I believe someone could explain the issue clearly.