Having a Question on JSF j:commandButton's action, chrome browser and JSF 1.1
Calling JavaScript function on click of command link as below
<h:dataTable>
<h:column>
<h:panelGroup rendered="#{expression which returns true}">
<f:verbatim rendered="#{someView.agentEdit}"> </f:verbatim>
<h:commandLink id= "editId" styleClass="commandLinkClass"rendered="#policyHistory.agentEdit}" onclick="return performPolicyHistoryAction('Edit', id);" value="Edit"/>
</h:panelGroup>
</h:column>
</h:dataTable>
With the above code I am getting the Link and it's able to call js function 'performPolicyHistoryAction'
In js function
function performPolicyHistoryAction(cntrlValue, cntrlId){
DWREngine.setAsync(false);
if (cntrlValue == 'Edit') {
document.getElementById("someString:lnkViewOnlyrefresh").click();
}
}
and someString:lnkViewOnlyrefresh is declared as
<h:commandButton action="#{someBean.viewOnlyAction}"
id="lnkViewOnlyrefresh" value="refresh" styleClass="hide" title="refresh"></h:commandButton>
here in chrome, not calling commandButton's action method. It's working fine in IE and FF
Note:If I put alert in <h:commandButton>'s onClick I am getting the alert.
Changed to onclick="return performPolicyHistoryAction('ViewOnly', id); " is changed to onclick="performPolicyHistoryAction('ViewOnly', id); return false;"
in belowcode
Working fine...