theo Posted May 16, 2018 Share Posted May 16, 2018 Hello Is there a way for a module to get an event via JS/JQuery when (actually before) a Page is saved? For example for showing an alert like "There are unsaved changes" or saving these changes automatically (Ajax)? Thank you. Link to comment Share on other sites More sharing options...
dragan Posted May 16, 2018 Share Posted May 16, 2018 This this thread: 1 Link to comment Share on other sites More sharing options...
theo Posted May 16, 2018 Author Share Posted May 16, 2018 @dragan Thanks, but this ist PHP, right? I need JS. But I think this seems to work afaics now. $("#submit_save").bind("click", function() { alert('beforesave'); return true; }); Thank you. Link to comment Share on other sites More sharing options...
dragan Posted May 16, 2018 Share Posted May 16, 2018 Yes, that's PHP, but you can also inject JS in a hook with $js = "<script>your script here...</script>"; $event->return = str_replace("</body>", "{$js}</body>", $event->return); 1 Link to comment Share on other sites More sharing options...
teppo Posted May 26, 2018 Share Posted May 26, 2018 Hey there, @theo! Just wanted to notify you that I'm moving this topic to the "Module/Plugin Development" subforum. The "Modules/Plugins" forum area is where support boards for existing modules live, while all module development related topics belong to the "Module/Plugin Development" subforum. Thanks, and sorry for the disturbance ? 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now