i often use but i have this problem.
if there is a whose action is delete some entity ,but i want notify user who click this commandLink a javascript function confirm(str); if the confirm() answer is false, it doesnot trigger a ajax function. So i begin to use jsf.ajax.request function;my code like this .
<h:commandLink value="ajax" onclick="return ask(this,event,null,'page');" actionListener="#{test.ajax}"/>
<h:inputText value="#{test.page}" id="page"/>
this is my javascript code
function ask(element,event,exec,target){
if(confirm("are you ready to delete it"))
{
try{
jsf.ajax.request(element,event,{execute:exec,render:target});
}catch(ex){
alert(ex);
return false;
}
}else
return false;
}
,but it can execute it successfully,but i found it not a ajax.other value for backing bean is updated too!
if sb can tell me ! Be grateful!
You don’t need to take over
<f:ajax>‘s job. Just return in the onclick.And use
actioninstead ofactionListener. You can returnnullorvoidthere.