WP auto adds <br> with form fields on same line (6 posts)

  1. gspark
    Posted 8 years ago #

    even in the page

    the label and input field are on the same line it addes a < br /> after the label

    is there anyway to stop this ?


    < label >< input > all on same line

    wordpress does it like this < label >< br />< input >

  2. kenneyjs
    Posted 8 years ago #

    I am having a problem with this as well. I try to enter a code with a $ <input> and it automatically puts the input on the next line. Anyone know of any solution to this?

  3. doug
    Posted 8 years ago #

    I was having the same problem. It looks like the bug will be fixed in version 2.4. It's a one-line patch, so you may be able to manually add it to your current installation.

    If you don't want to muck around with your source code, an easier fix is to put the label and input on consecutive lines, rather than the same line, like so:

    <input ... />

    As described in a different bug, no <br/> will be added and they will appear on the same line in your web page (the line-break is treated as whitespace in the browser).

    Beware: the patch and the workaround may end up canceling each other out, resulting in a line-break reappearing if you ever install 2.4! I really don't know.

  4. amoswright
    Posted 7 years ago #

    Here is an option that works for me - Go into "code" view for your post, then give your form an id, like <form id="your_form_id" ... and then in your theme .css file add this css style:

    #your_form_id br { display:none;}

    It is perhaps less covenient because you have to give each form the id manually, but involves no patches (plus, I couldn't get the line break fix described here to work for me).

  5. dankelly613
    Posted 7 years ago #

    Just FYI... I tested both doug's <label> method and amoswright's ID method.

    doug's works in FF (v2.0.0.12), but not in IE6 (v6.0.2900).

    (IE6 adds a phantom </p> tag where the <br> used to be - making the problem worse.)

    amoswright's works in IE 6, but not in FF.

    Both techniques together (with a little twist) yield success.

    doug's <label> method: (thanks doug)

    put the label and input on consecutive lines, rather than the same line, like so:

    <input ... />

    amoswright's UPDATED ID method:(thanks amoswright)

    #your_form_id p { display:none; }


    Thanks again guys!

  6. rhys
    Posted 7 years ago #

    Just got driven mad not solving this in 2.5.1, but found this post and had to use the -

    Text and Input on consecutive lines method and plus the p display:none to get both browsers conforming.

    All sweet now, but it the evil bug is still there obviously.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.