Support » Fixing WordPress » WordPress Editor changing my form source code

  • Hi folks.
    I maintain several WordPress sites since years.
    Today I noticed a strange behavior:
    I have a page where I used Text editor mode to implemented a form containing a select field with several options. Adding or changing options in Text editor mode was no problem since years.
    Today when I added an option and switched back to Visual mode, the Dropdown field was split into two. Changed back to Text mode and saw this code change (symbolic content):


    <select name=”myField”>
    <option value=”myOption1″>My Option 1</option>
    <option value=”myOption2New”>My Option 2 New</option>
    </select><select name=”myField”> <— this line has been added automatically
    <option value=”myOption3″>My Option 3</option>
    </select>

    Removed the closing and re-opening <select>-tag. When switching back to Visual mode, Dropdown field has been split again!

    Triple checked HTML syntax of the page’s code, even in DreamWeaver and other HTML Checkup Tools. Code is valid.
    Checked WordPress (4.9.2) and all Plugins, Themes to be on most current version. All fine.
    Deactivated ALL Plugins. Same strange behavior.
    Tested on Development site, here still WordPress version 4.9.1. Same behavior.
    Tested on TWO COMPLETELY DIFFERENT WordPress 4.9.2 sites with other themes, plugins. Same behavior.

    When I save my form changes still in Text mode, all is fine, no split Dropdown fields. Only when I change the select field in Text mode and switch back to Visual mode, the select field gets split into two.

    I assume, the problem might have been first occurred since the change of the TinyMCE editor components in WordPress Core 4.9

    Any ideas?

    • This topic was modified 3 years, 5 months ago by maltmann.
Viewing 2 replies - 1 through 2 (of 2 total)
  • There has been a long-standing issue in TinyMCE with markup being corrupted when switching from the Text to Visual tab and back again. So much so that we usually strongly recommend that you do not switch tabs back & forth in this manner.

    Have you considered using a plugin like Contact Form 7 for your form?

    Thread Starter maltmann

    (@maltmann)

    Thank you, esmi, for your hints.
    I know that switching between Visual and Text view can be tricky sometimes, but mostly concerning WordPress’ automatic adding/removing paragraphs and line breaks or removing “unwanted” tags or tag attributes.
    However, I never experienced this kind of corruption of my form fields before.

    Of course I use form plugins on others of my and my customers WordPress websites.
    In this case, using any kind of form plugin is not an option for me, since this form connects to a CMS system and contains various special and individual adaptions, scripts, etc.
    I tried several plugins in the first step but none of them handled everything according to my (quite special) needs.

    Should I be in good hope that the “Gutenberg” editor will handle that better in the future? 😉

    Matt

    • This reply was modified 3 years, 4 months ago by maltmann.
    • This reply was modified 3 years, 4 months ago by maltmann.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘WordPress Editor changing my form source code’ is closed to new replies.