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
NTSdevelopNTSdevelop 

is it possible to hide the "save and new" button?

I know I can hide or show standard buttons that belong to the details page, customizing the page layout of the custom object, but I can't find the way to hide the "save and new" button that appears when I click the "new" button to create a new record of a determined object.

Therefore, I was triying to do it with an s-control and javascript code.
I thought I could do it from a "new record" s-control I wrote to override the url created when clicking the "new" button, but then I realized that in that point the "new record" page doesn't exist and so does not the button I wanted to hide.
Anyway, the code was:

<script language="javascript">
try
{
    window.parent.location.href = "{!URLFOR($Action.MyObject__c.New , null ,         [saveURL=$SControl.MyNewObjectSave, retURL=URLFOR($Request.retURL,         null,null,false)] ,true)}";
    var elementArray = document.getElementsByName("save_new");
    elementArray[0].style.display = "none";
}
catch(exception)
{
    alert("Exception:" + exception);
}
</script>


An exception is thrown and says: Exception: TypeError: elementArray[0] has no properties
Is it possible to override the "new record" page, so that I can show or hide the buttons I want?

Maybe there's just a simpler way to do it or it is just impossible, because it is not suported.

Any comment would be appreciated.

Thanks,

new developer
Ron HessRon Hess
Correct, there is no way to customize the edit page or any buttons on it, including no way to add or remove buttons on the page.

your only choice is to replicate the edit page using AJAX/DHTML form that you create from scratch, which is easy to say, but in reality is an advanced s-control.

wylieatworknzwylieatworknz
Hi all,
this is something that I have been trying to do as well - I have put an idea up here: