You need to sign in to do that
Don't have an account?

pop up message on click of save on std page
Hi All,
We have a requirement to display user confirmation pop up on-click of std ‘Save’ button on opportunity page layout.
We have achieved it through JS on home page component. It works neatly for the normal edit page but does not work well on the inline edit page.
The problem is that although the pop up message gets displayed, the "SAVE' thereafter does not happen. Appreciate any help on this.
Below is the code snippet for inline edit page:
function overrideTheSavebtn(){ var URL = document.location.href; if(URL.indexOf('006') > 0){ var probab = document.getElementById('opp12'); if( probab.value!='90') { document.getElementsByName('inlineEditSave')[0].onclick = function(){ var choice = confirm('All orders will be deleted if you change the probability to less than 90. Do you want to continue?'); return choice;};} }} /* add a method onload */ var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = oldonload; } else { window.onload = function() { if (oldonload) { oldonload();} overrideTheSavebtn();}} </script>
Regards,
Sapna
I got it working for the inline edit page as well!
Here is the update code:
All Answers
There's not really any good way to override the Save button. Even the sidebar component is a bit of a hack, I'm surprised that it works because sidebar components are usually served from a different domain than the main page. You seem to be keying on onload, but inline edit doesn't really reload the page either.
Are you trying to pop up some kind of confirmation message or something?
Yes, we're trying to pop up a confirmation message.
The problem we are really facing is that the pop up message does display on the inline Save button as well but the record does not get saved.
This is the Onclick Function we've added:
If you see the page source, You will find that there is a onClick function defined on that button:
Im not much of a javascript person but i have a feeling it has got something to do with the way the below code is written:
Yeah you've got some seriously messed up code there. First of all, you are overriding the onclick action of the save button with your confirmation message; that's why it never saves, because it never gets called. Only your override ever gets called. Then you're appending your function to the onload of the window, which is not at all where you want your override.
Ironically it's not that far off from what you want to do. See what you're doing with the onload? If you applied that instead to document.getElementsByName('inlineEditSave')[0].onclick then it might actually work.
That said, this is a huge hack. I wouldn't be surprised if it randomly broke one day. Visualforce pages now support inline editing; you could do this by overriding the detail page with a Visualforce page now and override its save button to do your bidding. That would be much more robust. Just a thought.
I got it working for the inline edit page as well!
Here is the update code:
Hi sapnajaamdar,
Thanks for your question & answer!
I have the same request, my question is how to add this js code into the case edit page?
I am the new bird here, so would you please help me out?
...pls provide the above code if u can in chronological order and where we should put it(guidelines)....?????
Regards Abhishek
Could you please let us know how did u do it on edit page. I am able to do it on inlineedit page but it is causin problems on edit page.
A quick reply will be very helpful.
Regards.
Can you please provide me the code snippet of how to use popup on standard Save functionality.I have the same requirement.
Regards,
Ayush