7 Replies Latest reply on Aug 10, 2009 2:45 PM by Günter Schenk

    ADDT Dynamic Form + TinyMCE

    dloval

      Gunter,

       

      I have followed your tutorial on adding TinyMCE to ADDT's Dynamic Form. It works great when editing 1 record at a time, but when I choose to edit more than one record at once, it does not work. Specifically, the tinymce toolbars will load/appear for the appropriate textareas, and the textareas will appear as well, but the textareas are empty and will not allow you to type in them.


      Any ideas on making it work properly for multiple edits? Thanks for any help.

       

      I am using:

      Dreameaver CS3

      ADDT 1.0.0

      PHP5/MySQL5

       

      Code below:

       

      Script in HEAD:

      <!-- TINYMCE -->

      <script type="text/javascript" src="../Scripts/tiny_mce/tiny_mce.js"></script>

      <script type="text/javascript">

      tinyMCE.init({

      mode : "textareas",

      theme : "advanced",

      editor_selector : "bioText",

      });

      </script>

      <!-- END TINYMCE -->

       

      Instance used in BODY:

      <td class="KT_th"><label for="bioText_<?php echo $cnt1; ?>">Bio Text:</label></td>

                  <td><textarea name="bioText_<?php echo $cnt1; ?>" id="bioText_<?php echo $cnt1; ?>" cols="50" rows="15" style="width:500px" class="bioText"><?php echo KT_escapeAttribute($row_rsbmg_bios['bioText']); ?></textarea>

                      <?php echo $tNGs->displayFieldHint("bioText");?> <?php echo $tNGs->displayFieldError("bmg_bios", "bioText", $cnt1); ?> </td>

       

       

      --

      Thanks. Any help appreciated.

      DL

        • 1. Re: ADDT Dynamic Form + TinyMCE
          Günter Schenk Level 4

          The code you posted seems OK in general, and the required elements "editor_selector" and the corresponding textarea CSS class "bioText" have also been correctly defined.

           

          That said, it should in theory work, but most probably it just doesn´t because of this:

           

          ------------

          .........

          theme : "advanced",

          editor_selector : "bioText",

          });

          -----------

           

          Please try with removing the trailing comma from the last line...

           

          editor_selector : "bioText",

           

          ...because the very last item within an array (regardless if it´s PHP or JavaScript) may not have a trailing comma at all, and I assume that the reason for your issue is a javascript error which is related to that trailing comma.

           

          Cheers,

          Günter

          • 2. Re: ADDT Dynamic Form + TinyMCE
            dloval Level 1

            Gunter,

             

            I tried what you recommended (remove the trailing comma), but the problem persists. My code now reads in the head as follows:

             

            <!-- TINYMCE -->

            <script type="text/javascript" src="../Scripts/tiny_mce/tiny_mce.js"></script>

            <script type="text/javascript">

            tinyMCE.init({

            mode : "textareas",

            theme : "advanced",

            editor_selector : "bioText"

            });

            </script>

            <!-- END TINYMCE -->

             

            Any other ideas? Has this error occurred before?

             

            Thanks again for the help. -D

            • 3. Re: ADDT Dynamic Form + TinyMCE
              dloval Level 1

              Gunter,

               

              I just discovered one detail that may help. If I disable in the Dynamic Form Layout Server Behavior the option "Display As Grid When Editing Multiple Records" all appropriate textareas work. But as soon as I re-enable the "Display As Grid" option, they appear empty and uneditable.

               

              Any way to get it working with the grid style. I really like the convenience of the grid with the ability to copy-down values to multiple records. I don't want to loose that ability.

               

              Let me know what you think...if that helps isolate the problem.

               

              Thanks again -D

              • 4. Re: ADDT Dynamic Form + TinyMCE
                Günter Schenk Level 4

                dloval wrote:

                 

                Gunter,

                 

                I tried what you recommended (remove the trailing comma), but the problem persists. My code now reads in the head as follows:

                 

                 

                <!-- TINYMCE -->

                <script type="text/javascript" src="../Scripts/tiny_mce/tiny_mce.js"></script>

                <script type="text/javascript">

                tinyMCE.init({

                mode : "textareas",

                theme : "advanced",

                editor_selector : "bioText"

                });

                </script>

                <!-- END TINYMCE -->

                 

                Well, I see that you´re using TinyMCE´s "advanced" theme, but without specifying any additional theme options like what you see on the TinyMCE website itself and in the sample script I provided -- dunno if this happens because of the missing "advanced" options, so please try and switch TinyMCE to a "simple" theme which doesn´t need any extra configuration.

                 

                theme : "simple",

                 

                ...and see if this works.

                 

                Instead of that you can also try keeping the "advanced" theme and include the rest of the configuration parameters I provided in the sample script.

                 

                Cheers,

                Günter

                • 5. Re: ADDT Dynamic Form + TinyMCE
                  Günter Schenk Level 4

                  dloval wrote:

                   

                  Gunter,

                   

                  I just discovered one detail that may help. If I disable in the Dynamic Form Layout Server Behavior the option "Display As Grid When Editing Multiple Records" all appropriate textareas work. But as soon as I re-enable the "Display As Grid" option, they appear empty and uneditable.

                   

                  Any way to get it working with the grid style. I really like the convenience of the grid with the ability to copy-down values to multiple records. I don't want to loose that ability.

                   

                  Let me know what you think...if that helps isolate the problem.

                   

                  Thanks again -D

                   

                  Yup, this definitely helps isolating the problem, and thanks for sharing this !! Well, now that this is sorted out, I have to admit that I have no idea how to get this "fixed", as this would mean to detect the possible trouble-makers in either/and/or the ADDT/TinyMCE javascript code libraries, and this is clearly beyond my capabilities

                   

                  Cheers,

                  Günter

                  1 person found this helpful
                  • 6. Re: ADDT Dynamic Form + TinyMCE
                    dloval Level 1

                    Gunter,

                     

                    As a last resort, I moved the code ( class="bioText" ) in the textarea code, and it fixed the issue.

                     

                    Old Code:

                    <textarea class="bioText" name="bioText_<?php echo $cnt1; ?>" id="bioText_<?php echo $cnt1; ?>" cols="50" rows="15" style="width:500px">

                     

                    New Code:

                    <textarea name="bioText_<?php echo $cnt1; ?>" id="bioText_<?php echo $cnt1; ?>" cols="50" rows="15" style="width:500px" class="bioText">

                     

                    For some reason multiple edits require the class="<classnamehere>" defined at the very beginning of the textarea code.

                     

                    Maybe this will help someone else in the future. Thanks Gunter for stearing me in the right direction.

                     

                    -Deeds

                    • 7. Re: ADDT Dynamic Form + TinyMCE
                      Günter Schenk Level 4

                      dloval wrote:

                       

                      ...

                       

                      For some reason multiple edits require the class="<classnamehere>" defined at the very beginning of the textarea code.

                       

                      Maybe this will help someone else in the future. Thanks Gunter for stearing me in the right direction.

                      Hi Deeds,

                       

                      thanks so much for sharing your interesting finding ! Didn´t know that the position of that CSS class attribute would make such a difference -- isn´t this weird ?

                       

                      I think I´d better add a note to the tutorial and tell folks to move it towards the end in any case, and you´ll of course get acknowedged for finding this out :-)

                       

                      Cheers and thanks again,

                      Günter