I have a h:commandLink in one of the column in datatable.
JSF
<h:commandLink id="save" actionListener="#{ApplicationManagerBean.update}"
rendered="#{routeappcode.edit}"
value="save" onclick="return validateRow(this)"/>
Generated HTML is
<a id="routeappcodesummary:summarytable:2:save"
onclick="var cf = function(){return validateRow(this)};
var oamSF = function(){return oamSubmitForm('routeappcodesummary','routeappcodesummary:summarytable:2:save');};return (cf()==false)? false : oamSF();"
href="#">save</a>
Mojarra 1.2_15
<a href="#" onclick="var a=function(){return validateRow(this);};var b=function()
{if(typeof jsfcljs == 'function'){jsfcljs(document.getElementById('j_id_jsp_1765393453_2'),
{'j_id_jsp_1765393453_2:j_id_jsp_1765393453_3:0:j_id_jsp_1765393453_7':'j_id_jsp_1765393453
_2:j_id_jsp_1765393453_3:0:j_id_jsp_1765393453_7'},'');}return false};return (a()==false) ?
false : b();">test</a>
Here the generated javascript for onclick encapsulates the script provided in JSF tag.
function validateRow(link){
//link is not a link object but some window object.
var parent = link.parentNode;
}
Here in javascript function we don't get a link object but a window object. Reason is script provided in JSF tag was encapsulated and due to that value of this reference changes.
How can I solve this problem, so that I can get link object in my script?
Using onmouseup won't work in IE 6.
Using JSF 1.2