cancel
Showing results for 
Search instead for 
Did you mean: 

Are you sure? dialog box

VeeHamilton
Contributor

We have the standard list of cross-references to another application on our layout. When someone goes into Edit mode and clicks one of the little X buttons to remove a cross-reference, we'd like to have Archer pop up a dialog saying "You are removing a cross-reference. Are you sure?" with OK/Cancel buttons, or something similar. 

 

How can we achieve this with a custom object (or other method)?

1 REPLY 1

VeeHamilton
Contributor

Found a snippet of jquery that did what I wanted in a Custom Object:

 

<script type="text/javascript">
    $(document).ready(function() {
         $("a[class='GridRemoveImage']").each(function(){
             // Cache event
             var existing_event = this.onclick;

             // Remove the event from the link
             this.onclick = null;

             // Add a check in for the class disabled
             $(this).click(function(e){
                  var result = confirm("Are you sure?");
                  if (result == false) {
                     e.stopImmediatePropagation();
                     e.preventDefault();
                  }
             });

              // Reattach your original onclick, but now in the correct order
              // if it was set in the first place
              if(existing_event) $(this).click(existing_event);
      });
});
</script>