Good art is a taste, good design is an opinion.


Come as guest, stay as family.
Board Index

Come as guest, stay as family.


You are not connected. Please login or register

Foto

[Javascript] SCEditor confirmation message



View previous topic View next topic Go down Message [Page 1 of 1]

1
Offline

  Shadow

avatar
Administrator
Administrator


Tutorial: SCEditor confirmation message

This script will ask you if you want to leave a page if your message is not finished and you already clicked X button by mistake.


--> Tutorials, tips and tricks <--
SCEditor confirmation message



- Javascript:
Placement: In all pages
Code:
[panda=js]
$(function () {
  var submit_clicked = false;
  $('input[type="Submit"]').click(function () {
      submit_clicked = true;
  });
  window.onbeforeunload = function () {
      var b1 = $("form[name='post'] input[type='submit'][name='prevent_modif']").length;
      var b2 = $["sceditor"] && $('#text_editor_textarea').sceditor("instance").val();
      if ((b1 || b2) && !submit_clicked) {
          return "There is still an unsent message on this page. Are you sure you want to quit?";
      }
  }
});



- Preview:





© PunBB Design


If you have any questions related to this topic create a topic with the following title:
SCEditor confirmation message

Powered by PunBB
Currently 0 users have thanked Shadow for this post:

2
Offline

  Michael_vx

avatar
Punbb Junior
Punbb Junior
great work ^_^
tested on phpbb2
Smile

Powered by PunBB
Currently 0 users have thanked Michael_vx for this post:

View previous topic View next topic Back to top Message [Page 1 of 1]


Topic URL's

URL
BBcode
HTML

Permissions in this forum:
You cannot reply to topics in this forum