WordPress.org

Forums

[Plugin: Contact Form 7] Contact form and WordPress adding <p> tags (5 posts)

  1. jcyl29
    Member
    Posted 5 years ago #

    Hi, this contact form plugin works fine for me. I just have a issue of my page being validated. The beginning of the contact form code starts with a <div> tag. Thanks for WP's annoying feature of adding <p> where I don't want them, it adds a <p> before that <div> and thus results in a validation error. Does anyone know how to turn this stupid feature off? I've already looked into turning off the wautop function in the default-filters.php file and that hasn't stopped the <p> adding. My page with the contact form plugin used is here:

    http://ovson.com/contact/

  2. esmi
    Forum Moderator
    Posted 5 years ago #

    I don't think that the contact form is adding this <p> tag. It may be coming from your template or the enclosing post's content. I've used Contact Form 7 many times and I've never had this problem. and, yes, I do validate all pages so I know I've not had an issue with an unclosed p tag.

  3. PhiSYS
    Member
    Posted 5 years ago #

    Same problem here.

    • I'm using Contact Form 7 in a WordPress Page,
    • its content is only the [contact-form ...] tag.
    • My contact-form starts with a <label> tag (no blank-spaces before).

    Contact Form 7 is adding its form tag and wrappers, and then a <p> tag (which never closes), and then my first <label>... resulting in validation error.

    Any workaround?

  4. esmi
    Forum Moderator
    Posted 5 years ago #

    Place each label/input pair in a set of <p></p> tags? Or enclose all label/inputs inside the form within a set of <p></p> tags.

  5. PhiSYS
    Member
    Posted 5 years ago #

    Thank you, the workaround worked.

    But I still consider this behavior a bug, some people would like to use:

    <dl>
      <dt><label for="...">Label</label></dt>
      <dd><input id="..." name="..." type="text"/></dd>
    <dl>

    which is easily stylable, and could be semantic in some context.

Topic Closed

This topic has been closed to new replies.

About this Topic