Forums

Contact Form 7
[resolved] new line tag in form output (5 posts)

  1. MARijlaarsdam
    Member
    Posted 4 months ago #

    Hi, Thanks for Contact form 7. I have a great time using it. Part of my form looks as follows:

    <table>
    <tr>
    <td align="center"><label for="Name">Naam</label></td>
    <td align="left">asdf[text* Name 25/]</td>
    </tr>
    </table>

    My problem is that I cannot vertically align the controls in the second column. In the stylesheet:

    .entry td {
    vertical-align:middle;
    }

    works fine for the label, but not for the controls inside the span created by CF7; a bigger space remains above the control than below. However, as you can see (if you try this form), the "asdf" string is not on the same line in the form, while it should be according to the html. This is because the code generated by CF7 includes a <br /> tag; a line break as is visible in the form. This only holds for the normal text field, not for the text area. (I have not tried the other controls yet). See:

    <table>
    <tr>
    <td align="center"><label for="Name">Naam</label></td>
    <td align="left"><span class="wpcf7-form-control-wrap Name"><br />
    <input type="text" name="Name" value="" class="wpcf7-text wpcf7-validates-as-required" size="25" /></span></td>
    </tr>
    </table>

    I have not been able to locate where in the code this tag is added, but I need to remove it since it's visually screwing up the form.

    Thanks for any help you can offer!

    Regards,
    Martin

    http://wordpress.org/extend/plugins/contact-form-7/

  2. MARijlaarsdam
    Member
    Posted 4 months ago #

    Hi,

    Lines 89 and 93 generate the html (text.php), but I do not see how an <br /> tag is added there. Moreover, this code looks no different from the same function in textarea.php where this problem does not occur.

    Thanks for any help.

    Regards,
    Martin

  3. Takayuki Miyoshi
    Member
    Posted 4 months ago #

    The <br /> tag is not generated by Contact Form 7. Maybe your theme or one of other plugins does.

    One more advice, you shouldn't use "Name" as the name of the tag. See FAQ.

  4. MARijlaarsdam
    Member
    Posted 4 months ago #

    Thanks!

  5. MARijlaarsdam
    Member
    Posted 4 months ago #

    I found the problem: PHP Shortcode (plugin) somehow adds these breaks.

    Solution: do not use PHP Shortcode (old), but Shortcode Exec PHP (recent, same and more functionality).



Reply

You must log in to post.

About this Plugin

About this Topic