PHP Developer / Moodle Developer

PHP Moodle Developer
About me I'm PHP developer with 13 years of experience. I've prepared Moodle/Totara custom development for last 5 years. I built my first software when I was 9 years old. Welcome to my site!

Częstochowa, Poland
+48 668 690 844

Warn user before leaving with unsaved changes

Back to Moodle code tips

# moodle# form# javascript

If we want to warn user about unsaved changes we can use the beforeunload default event. Here is an example:

function confirmation() { return 'ALERT MESSAGE'; }

exit_message = function() {
 window.onbeforeunload = confirmation;


unexit_message = function() {
 window.onbeforeunload = null;

$('#id_submitbutton, #id_cancel').click(unexit_message);

Notice that default Moodle Submit button and Cancel button remove the warning as pressing these buttons means that user know he is doing :-)

Back to Moodle code tips
PHP Moodle Developer
I'm offering wide range of development for your Moodle / Totara LMS system. As a Moodle developer I can prepare for you fency dashboards, new blocks, new local plugins, report builder custom sources and other types of plugins. I can extend default Moodle / Totara functionality according to your ideas and needs. Because I have strong experience in general PHP field I can implement an application from scratch using any modern framework like Laravel or Phalcon -- Bartosz Hornik, PHP Moodle developer.