-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unclosed p tag if there is a linebreak before [/group] #85
Comments
Hi @erikyo thanks for the bug report. However, I don't believe this is something that should be fixed on my side. groups are converted to divs by the plugin. The p tag is part of the auto-p magic CF7 performs. If you write this code:
It will lead to the same problem.
So the problem appears either with or without conditional fields. |
No, unfortunately I think the problem lies in this code because removing that part the issue disappear: contact-form-7-conditional-fields/cf7cf.php Lines 421 to 454 in ac37f85
Anyway, even it was somewhat related to wordpress it need to be escaped... I tried without your plugin enabled and the issue doesn't happen and the generated html is fine. Please, I don't want to keep anymore a fallback (which turned out to be somewhat fruitless) to fix an issue that come before my plugin... so please fix it, if you need a hand just ask! 😉 |
ok, will check again |
Thanks! i can explain why this happens in addition. without the wpcf7cf_properties: <p>[group g]<br />
<span>yomama</span></p>
<p>[/group]</p> with: <div data-id="g" data-orig_data_id="g" data-class="wpcf7cf_group">
<span>yomama</span></p>
</div> It seems that the regex does not work as intended when the line is breaked with a |
Hi @erikyo, I tried again with a fresh installation of WP with only CF7 5.6.4 installed, and the problem remains. If I create a form with this code:
it results in this HTML:
The last version of CF7 (5.7) seems to output valid HTML, but it f***s things up with unnecessary
I'm thinking about disabling the |
You're right, the issue is partially due to autop, but I guess that disabling it isn't the right way to fix it... the problem is that [group] is not a true html tag, and this allows the tags to be crossed before the regex split... maybe it should be converted to a div before autop? |
Well.. it is converted to |
Ah ok! I just tried again (with the last cf7 version - 5.7) and let's just say it solved it for me, because what matters was that the generated code was valid. Isn't very nice btw, but at least it is valid. I can confirm that your first example renders like below, so for me the issue is solved (and wasn't in your repo). Thanks for the support!
|
* Fully tested with Contact Form 7 version 5.7 (when WP_DEBUG is false). Note: due to some errors in Contact Form 7 version 5.7 you will need to make sure WP_DEBUG is set to false in your wp-config.php file. * disable automatic insertion of paragraphs. Recent CF7 updates have changed the autop mechanism, causing too many problems with parsing the HTML code. If you still want to use autop (at your own risk) copy this code to your functions.php file: `add_filter( 'wpcf7_autop_or_not', '__return_true', 41, 0);`. Untill further notice Conditional Fields and Conditional Fields for Contact Form 7 will not use the automatic paragraph feature of CF7. Always try to write clean and valid HTML code. [GH issue 85](#85)
hi @pwkip,
today a user of the wp forum made me discover that if you put a empty line before the row with [/group] in the cf7 mail template some non-validable code will be outputted.
cf7 mail template test:
will return:
Not critical but this makes my plugin buggy because I use DOMDocument() to parse the form and unclosed tags are not allowed. So please fix :P
(wp 5.8 - cf7 5.4.2 - cf7cf 2.0.4)
The text was updated successfully, but these errors were encountered: