1

I have a Details Page which has Delete button of type (Details Type Button) whose Content-Source is of type on click javascript enabled. But if i keep it on click javascript enabled the button does not render on the mobile platform. So i changed its content-source type to Visual Force page.

I want to display a confirm message if the user clicks on this delete button on the same visual force page rather than it being redirected to another and then showing the confir message,how do i map this button into the visual force page (in this case a QUOTEDETAIL.page).

I have a small javascript which does it on-click, but how can i make this script execute since i changed its content-source type to VF page. The script is as shown below.

 <script type="text/javascript">

    var confirmed = confirm('Are you sure you want to delete the quote?');

     if (confirmed) { 
        window.location.href = '{!URLFOR($Action.Quote__c.Delete,Quote__c.Id)}';
    } 

</script>

How can i get this script execute on click of this DELETE button, since it a VF page now not an on click javascript mode type? Please help me out

1

If you are working with visualforce you can take below sample to implement this

  <script>
      function scriptcall(){
           var confirmed = confirm('Are you sure you want to delete the quote?');

       if (confirmed) { 
            window.location.href = '{!URLFOR($Action.Quote__c.Delete,Quote__c.Id)}';
           }else{
               serveraction();
            }
      }
  </script> 

  <apex:actionfunction action="{!serveraction}" name="serveraction"/>
  <apex:commandbutton value="delete" onclick="scriptCall();"/>

In short you can call server side action from Javascript of the Browser

0

This is a Detail Page button. So it does not get displayed by default. I dont have any Apex CommandButton tag in my page. Hope i was to able to explain you. So then how can i map that custom button which is of type Detail Page Button under Custom Links, Button for every object in salesforce and call the javascript when this button(int this case 'Delete') is clicked??

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.