We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19368
    • 40 Posts
    Hey folks,

    In a document, whenever I save it with <form name=’formname’ id=’formname’ action=’page.php’> after it is saved I look at the HTML and it has been changed to <form id=’formname’ action=’page.php’>
    removing the name=’’.

    I have tried using tinymce, source and HTML, same effect each time.

    This is a real drag trying to do javascript form validation

    I have kludged around it by editing the mySQL directly.

    Any ideas on the cause?.Or more importantly, a fix?

    Thanks in advance
      • 9207 ☆ A M B ☆
      • 2,475 Posts
      Sounds like odd behavior... are you trying to put that bit of HTML in the content field? Try this, go to edit the page, then flip over to the page settings on the second tab and choose to disable richtext. Then try editing the content without TinyMCE (use just plain HTML).

      I’ve had problems with TinyMCE converting &’s to &amp; but I haven’t seen the problem you’re describing.
        • 19368
        • 40 Posts
        Hmmm...this gets curiouser and curiouser.

        No, I am not putting in the content field, just trying to change the <form> tag

        I wanted to test your idea and duplicated my document - which has the name="" in it.

        When I open the duplicate document it has already been removed. However if I right-click it in the document tree and preview, then look at source it is there.

        So it seems that somewhere the code is being removed when the editor opens it.

        Ahhh...but doing what you suggested (disable rich html) has solved the problem.

        Any idea what exactly is going on?
          • 30223
          • 1,010 Posts
          The name attribute is not in the list of valid_elements for <form> and thus get’s stripped by tinyMce in it’s clean-up routine.

          You can configure tinyMce to allow the name attribute but I’m not sure how this is done with the modx tinyMce plugin. Perhaps restate your question in the tinyMce plugin support forum and someone might know how to do this.
            • 19368
            • 40 Posts
            Thanks for that

            How bizarre! Not having the name parameter in <form>

            How do you access the object?
              • 4041
              • 788 Posts
              The spot you are looking for to modify resides in the:

              assets/plugins/tinymce###/xconfig.js file

              This file sets the valid,extended_valid, and invalid elements which tinymce allows/disallows in the content.

              the var tinymce_valid_elements is the defaults used, and can be modified using the var tinymce_extended_valid_elements settings like so:

              var tinymce_extended_valid_elements = "form[name|action|method|id]";

              note that:
              1.) the order you place the elements in the var are the order in which they will appear in the form code after saving.
              <form name="formname" action="page.php" method="post" id="formname"></form>
              2.) the extended_valid_elements will be used for that element instead of the valid_elements if this var is modified.

              http://wiki.moxiecode.com/index.php/TinyMCE:Configuration/valid_elements
              http://wiki.moxiecode.com/index.php/TinyMCE:Configuration/extended_valid_elements
              http://wiki.moxiecode.com/index.php/TinyMCE:Configuration

              ** it seems that the extended_valid_elements does not add to the valid_elements array as it states in the docs (in my tests), but ovverride it completely so keep that in mind.
              ** also make a backup of the files you modify just in case smiley
                xforum
                http://frsbuilders.net (under construction) forum for evolution
                • 19368
                • 40 Posts
                Nice, thanks.

                Have made the changes.

                Another oddity is that it didn’t have "id" as one of the parameters yet it was allowing id in the tag.

                Is the omission of "name" a bug? Seems like it to me.

                Pretty important key for a form.
                  • 4041
                  • 788 Posts
                  After further research, the reason the id was kept is that anything found with the control character @ is valid for all elements:

                  @ Rules with this name will be applied to all elements. So @[attr1|attr2] will enable attr1 and attr2 for all elements.

                  the "id" is in the @ section of the valid_elements var smiley

                  That being said, you could likely just add "name" to the first part of the var valid_elements and it would be available for any element.
                    xforum
                    http://frsbuilders.net (under construction) forum for evolution
                    • 9207 ☆ A M B ☆
                    • 2,475 Posts
                    Man... sometimes people nag me for not using the "simple solutions", but if TinyMCE causes this much trouble, I don’t feel like I’ve been missing out typing my HTML by hand for all these years.
                      • 19368
                      • 40 Posts
                      lol.

                      I have always used FCKeditor in applications...will stick with it.