I don’t understand your logic what are you trying to say?
Let’s assume the button will hide after save. But when you refresh the button will come back. You have to understand the logic. Without logic you cannot implement anything.
Plz check “Lead” Doctype, and apply above code. Then you will understand. I want to Hide those two buttons when I click save button instead of showing.
@Atheetha, Let me explain the difference between “onload” and “refresh” in simple terms.
Onload: This event triggers when you reload the page. However, if you open a record, go back to the list, and then open another record, sometime script might not work as expected, like hiding a button.
Refresh: This event triggers every time you open a document, ensuring the script runs. If it doesn’t work as expected, try increasing the setTimeout. In your case, “onload” might not be the best option.
You should understand form events before applying scripts. Simply adding a script won’t guarantee it works unless you understand how these events function.