function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Mike FitchMike Fitch 

Delete button popup window not functioning

I have a VF form that i created and I included a delete button with a popup window that asks the user to confirm deletion. The cancel button works properly, but if the user clicks OK, it takes them to a page that has an error message saying URL no longer exists. Here is the code:

<script type="text/javascript">
            function confirmDelete() {
            return confirm('Are you sure you want to delete?');
            }
            </script>
            <apex:commandButton action="{!delete}" value="Delete" onclick="if(!confirmDelete()) return false;" reRender="PrecallForm"/>

Any suggestions?
kaustav goswamikaustav goswami
After the delete has taken place where are you re-directing the user? Do you have any controller method from where you are returning a page reference?

Can you please post the rest of the code?

Thanks,
Kaustav
Mike FitchMike Fitch
I do not have a controller method. I figured using the standard controller, it would redirect the user to the object list view page. The strange thing is, I use this exact code in a different org and it works just fine.
kaustav goswamikaustav goswami
So from where is your page launched? Through some button or link on the standard page?

Can you give that info and the VF page code? The problem might lie in the way a parameter called return url is getting set. For that it will be helpful if you can provide the VF page code and the way the page is launched that is the url of the page when it is loaded.

Thanks,
Kaustav
Mike FitchMike Fitch
I resolved this one myself. It would help if I created a Tab for my custom object first. That is a really silly mistake on my part :-P. Sorry to have wasted your time. Thanks for your help though.