Closed rantonse closed 1 year ago
Thanks for your suggestion. Your example breaks the Validation because the JSON outputs HTML and the comment falls out. I hope i explained clearly. If i uncomment the oncoming JSON, the validation will work. But i don't know, if the minify will remove that json. I fixed it in 3.4.7. Can you test it? If not: Probably the minify-plugin has an option to exclude i specific url.
Just let me know
I am not sure I completely understand. I tried the 3.4.7 fix on a fresh installation, but the error remains.
On my end, I got it to work by wrapping the middle <?php ?>
part in validation.php
within <!--[
and ]-->
.
In other words, <?php ... ?>
becomes <!--[<?php ... ?>]-->
.
For the regular expression in index.php
, I replaced (.*?)
with \s\<\!--\[(.*?)\]--\>\s
.
I am not sure if this is a good idea, but this is my current workaround. :)
That will break the inline validation. (Autovalidation during form fill). You can check it in your console:
Your code will probably case an error. Because inside '' will be a JSON with HTML-Code. Which break the comments. Can you confirm that?
Since I haven't heard anything more, it seems to me that a solution to this problem has been found. I'il close this issue.
Hi, and thanks for the plugin!
There is an incompatabilty with afbora/kirby-minify-html.
To reproduce, I added the latest versions of both plugins to the starter kit
After adding a form to the home page, and clicking send without any fields filled out, you get both a 404 error and a parse error.
The reason for the error is that the kirby-minify-html plugin removes comments. After some experimentation, I found out that the kirby-minify-html plugin does not remove conditional comments (with the
<!--[if IE]>
syntax), so a fix would perhaps be to change the comments syntax?I tried that with success, and only two files need to be slightly changed:
The changes I did are here:
Basically, these are the changes to the
validation.php
file:<!-- Startvalidation:<?= $form->id() ?> -->
to<!--[Startvalidation:<?= $form->id() ?>]-->
.<?php ?>
to<!--[<?php ?>]-->
.<!-- Endvalidation -->
to<!--[Endvalidation]-->
.Then, in
index.php
, changing the regexp/\<\!-- Startvalidation:'.get('id').' --\>(.*?)\<\!-- Endvalidation --\>/s
/\<\!--\[Startvalidation:' . get('id') . '\]--\>\s\<\!--\[(.*?)\]--\>\s\<\!--\[Endvalidation\]--\>/s
.Do you see any downsides to this change?