• tryintolearn

    (@tryintolearn)


    I’m basically new to WP and am trying to migrate a subscribe form from an existing site to WP. The form is in a table and I’m finding that when existing tds have a colspan that includes several fields, WP often inserts a new line when none is called for. I was able to fix many of them by removing all spaces in the original code, but WP is still consistently creating a new line every time there’s a select box. When I examine the code with Firebug, WP is putting an empty p tag before each select box.

    I thought maybe WP just didn’t like my table format but I tried putting the same code in a p tag and WP still inserted an empty p tag before the select box. A code sample is here – but it’s doing it in front of every select box – not just this one:

    Federal Tax ID:<span class="redBold">^</span> <input type="text" name="taxid" value="" />Type:<span class="redBold">^</span><select name="taxidType"><option selected="selected" value="SY">SSN</option><option value="EI">EIN</option></select>

    I don’t do the JS or PHP for this so the code above is incomplete. My job is just to get the basic HTML in place.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Not sure I see the p tag issue in your code snippet

    Thread Starter tryintolearn

    (@tryintolearn)

    That’s the code I input in the Text editor. What I get back is either this:

    <br>
    Federal Tax ID:
    <span class="redBold">^</span>
    <input type="text" value="" name="taxid">
    Type:
    <span class="redBold">^</span>
    <br>
    <select name="taxidType">
    <option value="SY" selected="selected">SSN</option>
    <option value="EI">EIN</option>
    </select>

    or

    <p> </p>
    Federal Tax ID:
    <span class="redBold">^</span>
    <input type="text" value="" name="taxid">
    Type:
    <span class="redBold">^</span>
    <p> </p>
    <select name="taxidType">
    <option value="SY" selected="selected">SSN</option>
    <option value="EI">EIN</option>
    </select>
    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Could you try deactivating all plugins and switching to the default Twenty Thirteen/ Fourteen theme to explore whether anything like that could be responsible?

    Thread Starter tryintolearn

    (@tryintolearn)

    All plugins deactivated – still inserts br and/or empty p tags in themes Twenty Eleven through Twenty Fourteen. No difference.

    Thread Starter tryintolearn

    (@tryintolearn)

    Any other ideas on this? I’ve tried everything I can think of but nothing is helping. I’ve Googled it and found a fair number of references to other users who’ve had similar issues (WP inserting empty p and/or br tags) – mostly a few years back. People have suggested various solutions but none of them have consistently seemed to work for all users and what’s more disturbing to me is that no one has ever seemed to understand what’s causing it. I’m leery of applying “fixes” when we don’t understand the cause.

    Anyone?

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    For now can you use CSS to stop the <br /> and <p> elements from affecting your form?
    E.g.:

    .yourForm p,
    .youForm br {
     display: none;
    }

    Thread Starter tryintolearn

    (@tryintolearn)

    I can work with that kind of fix for now, but I’d still like to know what’s causing it. If anyone has any ideas, please let me know.

    Thanks, Andrew.

    Thread Starter tryintolearn

    (@tryintolearn)

    I discovered another issue and am putting it in this same thread because I’m beginning to wonder if there’s something wrong with my install. I can add a regular HTML comment to a page with no trouble UNLESS it has code in it. Something about the closing angle bracket causes WP to interpret the end of the HTML comment (the — in –>) as an endash so it inserts the special character for an endash, and, of course, that wrecks everything.

    Could some of these issues be because I’m working locally through XAMPP? Do most people work locally or directly on the server? I’ll have access to the server version next week but I don’t right now.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Empty p tags inserted before the select tag’ is closed to new replies.