Niko
  • Administrator

      Reputation : 319
      Registered on : 2012-02-22
      Posts : 2366
      School of codes courses: coming soon
    Set default message in a textarea


    Description


    Using this resource you will be able to have a default content in a textarea, due to the section you are posting in (only in one, two, etc)  yes 


    Demo



    Code

    You have to reply to this topic to see the code (avoid Flood)


    General Informations

    Code creator: Ange Tuteur
    Code tested on: PhpBB3 - Google Chrome (works even on others)
    Checked by: Ange Tuteur (ESP)
    Extra infos:
    1. In the condition of the if statement is the following
      Code:
      document.location.href.indexOf('/post?f=FORUMID&mode=newtopic') > -1)

      You must change f=FORUMID to the ID of the forum you want this to work in.
      For example, if I wanted to add a form when users create a topic in this forum (http://www.domainname.com/f2-test) I have to use f=2
    2. To add a line break write : \n
      If you're using single quotes write : \'



    Codes last updated on 6th March 2014 - 16:56 by Ange Tuteur



    Niko wants you in the team Guest

    Community manager and Administrator at Forumattivo.com

    Ikerepc
    • Veteran staff member

        Reputation : 2
        Registered on : 2013-08-27
        Posts : 78
        :D
      Wow this look amaizing

      DDril
      • I'm a new member :)


          Reputation : 1
          Registered on : 2014-03-10
          Posts : 7
          Love Fmcodes
        Thanks

        DooGy00
        • ****


            Reputation : 1
            Registered on : 2013-07-29
            Posts : 56
          good work

          Webmen
          • I'm a new member :)


              Reputation : 0
              Registered on : 2014-03-14
              Posts : 7
              Love Fmcodes
            Cool  Cool  Cool

            Rhino.Freak
            • ***


                Reputation : 2
                Registered on : 2014-03-10
                Posts : 33
                Love Fmcodes
              awesome , thanks for sharing ..

              menyou
              • I'm a new member :)


                  Reputation : 1
                  Registered on : 2014-04-18
                  Posts : 8
                  Love Fmcodes
                for example why not using else 
                so if it's post?f=1&mode=newtopic 
                give it  $('#text_editor_textarea').val('CONTENT'); 
                but if forum id where 2 or 3 what ever give 
                $('#text_editor_textarea').val('this is another thing :)');
                 like this 

                Code:
                $(function() {
                    if (document.location.href.indexOf('post?f=1&mode=newtopic') > -1) {
                      $('#text_editor_textarea').val('CONTENT');
                    }
                else {      
                $('#text_editor_textarea').val('this is another thing :)');
                }

                });

                J0k3R^
                • *****


                    Reputation : 11
                    Registered on : 2014-04-25
                    Posts : 153
                    Love Fmcodes
                  Thanks, useful :)

                  Edit: how to add more than 1 line? i didnt get it  Confused

                  ALMOTALEG
                  • ***


                      Reputation : 1
                      Registered on : 2013-11-21
                      Posts : 37
                      LG
                    thank u

                    Brennan
                    • ****


                        Reputation : 2
                        Registered on : 2014-05-29
                        Posts : 61
                        Love Fmcodes
                      I'll take this to my advantage on my forum  :bene:

                      underestimated
                      • I'm a new member :)


                          Reputation : 0
                          Registered on : 2013-09-24
                          Posts : 4
                          LG
                        nice one Wink

                        cool
                        • **


                            Reputation : 0
                            Registered on : 2014-06-08
                            Posts : 12
                          thanks

                          Dark-Avenger
                          • ***


                              Reputation : 0
                              Registered on : 2013-10-23
                              Posts : 34
                              LG
                            thank you
                            Ops the code is not displayed:(

                            Niko
                            • Administrator

                                Reputation : 319
                                Registered on : 2012-02-22
                                Posts : 2366
                                School of codes courses: coming soon
                              Can't you see the code?



                              Niko wants you in the team Guest

                              Community manager and Administrator at Forumattivo.com

                              darkgoku
                              • **


                                  Reputation : 1
                                  Registered on : 2012-11-10
                                  Posts : 12
                                this is helpful for people

                                kodokguell
                                • **


                                    Reputation : 0
                                    Registered on : 2014-11-28
                                    Posts : 17
                                    Love Fmcodes
                                  thanks

                                  DL747
                                  • **


                                      Reputation : 0
                                      Registered on : 2014-12-13
                                      Posts : 23
                                      Love Fmcodes
                                    Useful

                                    Cata90
                                    • ***


                                        Reputation : 1
                                        Registered on : 2014-11-17
                                        Posts : 32
                                        Love Fmcodes
                                      good job

                                      Micul`Wji
                                      • ***


                                          Reputation : 0
                                          Registered on : 2014-03-01
                                          Posts : 34
                                          LG
                                        good job mans thatk i=you

                                        Andrei34
                                        • ***


                                            Reputation : 0
                                            Registered on : 2015-08-19
                                            Posts : 30
                                            Love Fmcodes
                                          thanks

                                          Yassine Bablil
                                          • **


                                              Reputation : 0
                                              Registered on : 2015-04-14
                                              Posts : 23
                                              Love Fmcodes
                                            thanks you

                                            tonetone
                                            • **


                                                Reputation : 1
                                                Registered on : 2015-01-16
                                                Posts : 11
                                                Love Fmcodes
                                              thank

                                              Gin Neos
                                              • **


                                                  Reputation : 0
                                                  Registered on : 2016-07-19
                                                  Posts : 17
                                                ty ty

                                                GAMSgr
                                                • ***


                                                    Reputation : 0
                                                    Registered on : 2017-02-10
                                                    Posts : 40
                                                    Love Fmcodes
                                                  good

                                                  xAlecsu
                                                  • **


                                                      Reputation : 0
                                                      Registered on : 2014-03-21
                                                      Posts : 13
                                                      Love Fmcodes
                                                    i want to see