问题描述:

Am using h:commandLink for delete,onclick of this link which enables the confirm dialog but when i click ok,it is not deleting..do i need to add any more?kindly help.

<h:commandLink update="#{cc.attrs.ajaxupdate}"

onclick="if (! confirm('Are you sure, you want to remove picture?') ) { return

false;}; return true; ">

<f:ajax listener="#{cc.attrs.deleteactionlistener}"/>

<p:graphicImage value="/resources/images/delete.gif" />

</h:commandLink>

网友答案:

You have to put the h:commandLink within an h:form element in order to submit your data and execute the handler. The onclick on the other hand is done without a submit.

By the way, what is the update attribute for? At least it's not in the standard h:commandLink.

网友答案:

Below is how I used...

<h:commandLink value="Delete" action="#{Bean.delete()}" 
    onclick="return confirm('Are you sure you want to delete?')" />
             ^^^^^^^

In your case it would be

<h:commandLink  update="#{cc.attrs.ajaxupdate}" 
     onclick="return confirm('Are you sure, you want to remove picture?')">

Hope this solves your problem.

相关阅读:
Top