Niko
  • Administrator

      Reputation : 319
      Registered on : 2012-02-22
      Posts : 2366
      School of codes courses: coming soon
    Alert message before closing a new post form
    Hello members,

    Description


    Ask before closing a new post page

    Set up


    Very simple, just add this Javascript code in your javascript panel:
    Code:
    $(function() {
      var t = $("#text_editor_textarea");
      if(!t.length) {
        return
      }
      var empty = /^\s*$/.test(t.val());
      t.keydown(function(e) {
        if(empty && !/^\s*$/.test(t.val())) {
          $(window).bind("beforeunload", function() {
            return"Vous avez commenc\u00e9 \u00e0 \u00e9crire un message"
          });
          empty = false
        }else {
          if(!empty && /^\s*$/.test(t.val())) {
            $(window).unbind("beforeunload");
            empty = true
          }
        }
      });
      t.parents("form").submit(function() {
        $(window).unbind("beforeunload")
      })
    });


    Customize the tutorial


    Not available!

    Demostration




    Technical problems


    If you notice that the tutorial doesn't work for a browser or for a version of forum (PhpBB2, PhpBB3, PunBB, Invision) contact an administrator and we will fill this field with your segnalation.

    Thanks, the staff



    For every problem or question please, contact us in the section Support for the tutorials, The staff will answer you as soon as it is possible...


    Friendly,
    The team of the Forum of Codes.



    Niko wants you in the team Guest

    Community manager and Administrator at Forumattivo.com

    Nick
    • Manager

        Reputation : 20
        Registered on : 2012-04-01
        Posts : 407
      Nice tutorial!



      Alert message before closing a new post form 15px10
      sivastar
      • ***


          Reputation : 0
          Registered on : 2012-03-26
          Posts : 49
        Thanks..!

        How to chnage this text?

        //This page is asking you to confirm that you want to leave - data you have entered may not be saved.//

        fascicularia
        • ****


            Reputation : 0
            Registered on : 2012-05-05
            Posts : 51
          1st My forum in your forum togheter

          Niko
          • Administrator

              Reputation : 319
              Registered on : 2012-02-22
              Posts : 2366
              School of codes courses: coming soon
            @fascicularia wrote: 1st My forum in your forum togheter
            What? I didn't understand :bene:



            Niko wants you in the team Guest

            Community manager and Administrator at Forumattivo.com

            fascicularia
            • ****


                Reputation : 0
                Registered on : 2012-05-05
                Posts : 51
              The tutoriel arises from a request of help which I made...

              Niko
              • Administrator

                  Reputation : 319
                  Registered on : 2012-02-22
                  Posts : 2366
                  School of codes courses: coming soon
                Yes :Good:
                Everything is helpful...



                Niko wants you in the team Guest

                Community manager and Administrator at Forumattivo.com

                fascicularia
                • ****


                    Reputation : 0
                    Registered on : 2012-05-05
                    Posts : 51
                  It's true that the forums of mutual aid of FA are a gold mine to create tutoriels