Override save method
!unsupported alert!
Unsupported, but this works :)
I do sometimes get the question how it is possible to override the save method. You could dig into the javascript files or htc files, but following this solution is a lot better.
You can modify the aspx file, which you want to change the behaviour of the save button. Insert this script into the file and you will get an alert before saving the file:
<script language="javascript">
//make the form aware of our new save method
function window.onload(){
crmForm.onsave = overriddenSave;
crmForm._bUseCustomSaveEvent = true;
}
//implementation of the new save method
function overriddenSave(){
//do your thing here
alert('Your modifications will be saved now');
//save the form.
crmForm.SubmitCrmForm(1, true, false, false, false);
}
</script>
Hope this helps!
4 comments:
Dear Ronald,
is it somehow possible to supply either true or false for the bClose parameter of SubmitCrmForm(), depending on whether the onSave() event was called by clicking on the 'save' or 'save and close' button? i would like to override the onSave() event like you did, but close the window when the 'save and close' button was pressed.
so somehow i would need to track the event caller ...
apart from that question i'd like to thank you for this code snippet!
regards!
Hi Maik,
I couldn't find anything regarding this. It might be possible to add some javascript codes to each of the buttons to identify which have been clicked. The adding of javascript code should be done using Joris Kalz' approach. Look at the 'Advanced UI Customization' post for the link.
Hope this helps,
Ronald
Hey Ronald,
thx for the hint, i will look into it!
Maik
Hi Ronald, could you give me your MSN? Mine is yanluckly@gmail.com
Post a Comment