Kush
Kush

Reputation: 23

Progress popup showing up after cancelling action in the confirmation popup

I have below code written to show a confirmation popup when deleting a user. Also I have progress popup ( tied to other pages also) which I have attached to this action.

But since both of them are onclick the progress popup appears even after the action is cancel in confirmation popup. I have tried attaching the progress popup with other event like 'start' but then it dosen't show up while action is performed.

Below is my code :

<div class="bt btDelete">
    <h:commandLink id="idDeleteUser" action="deleteUser" title="#{msg.btn_delete_user}"
                rendered="#{not user.completed and not empty user.id}" 
                onclick="if(confirm('#{msg.action_ask_delete_user}')) {return true;} else {return false;}">
        <span class="btleft" />
        <span class="btmiddle">#{msg.btn_delete_user}</span>
        <span class="btright" />
        <span class="clear" />
        <rich:componentControl for="inProgressPopup" attachTo="idDeleteUser" operation="show" event="start"/>
    </h:commandLink>
</div>

What could be the correction I should make with least changes?

Upvotes: 0

Views: 55

Answers (1)

Makhiel
Makhiel

Reputation: 3884

if(confirm('#{msg.action_ask_delete_user}')) {return true;} else {return false;}

Instead of just return false you can close the popup here as well:

#{rich:component('id').close()}

Upvotes: 0

Related Questions