plain-solutions-gmbh / kirby-form-block-suite

This form plugin for Kirby offers you maximum flexibility and usability. It can be used as a block anywhere you needed. This repository replaces the obsolete version 2.0.
Other
38 stars 11 forks source link

Issues with dynamic and on-submit validation #53

Closed brandsis closed 2 months ago

brandsis commented 2 months ago

Hi, Roman. I'm having problems with both dynamic and on-submit validation. You can replicate my issues at brandsistency.dev/brandsistency/contact.

To investigate, I have removed my custom form CSS and JS and have used your default styling. I do not have any custom block snippets. So, I think my form is as 'out of the box' as possible. I'm using the latest version 4.3.0.

Dynamic validation Only seems to work if the relevant field is selected and entered first. In my form, the email field is the third field. If I click into it first, type an invalid email format (e.g. "abcdefg") and tab to the next field, the invalid attribute is added to the input and the error message appears. However, if I start with another field, for example the first field (Name), fill the fields out in sequence tabbing as I go, when I get to the email field, fill that in with an invalid value and tab to the next field, the invalid attribute is not added and the error message does not appear.

(I'm not sure if there is dynamic validation of required fields but, if I click in a required field and click/tab away, there is no error message.)

On-submit validation I'm getting the following scenarios:

Are these bugs or issues with my implementation?

plain-solutions-gmbh commented 2 months ago

The problem is following:

is

should be

should_be

Something insert an extra ' in the response. What kind of plugin you have installed? Is there a compressing plugin activated?

brandsis commented 2 months ago

Thanks, Roman. Yes, I'm using Ahmet Bora's Minify HTML compression plugin. I'll try without and also look to see if there are any config settings I can adjust.

brandsis commented 2 months ago

The problem is following: is should be should_be

Roman, sorry if this is a stupid question but in what view are you seeing class='\"formblock__message--hidden\"' etc.? If I look at Dev Tools or at the page source, I just see class="formblock__message--hidden" with no \ and no '.

plain-solutions-gmbh commented 2 months ago

On enter a value (and leaving the field) there is a request going on:

Bildschirmfoto 2024-06-25 um 13 45 33

This '\" causes, that the browser insert "" and the HTML is not more valid anymore.

It seems, your website works now. Can i close this issue?

plain-solutions-gmbh commented 2 months ago

It's a known issue: https://github.com/youngcut/kirby-form-block-suite/issues/15

brandsis commented 2 months ago

It seems, your website works now. Can i close this issue?

My production website works because I have custom JS validating fields on focusout and on submission. Obviously, I'd prefer not to have to do that.

In my test website, I removed the Minify HTML plugin and the issue does go away. Form Block Suite is, of course, more important than Minify HTML for functionality. To check any performance impact, I just tried GTMetrix and it doesn't seem that removing Minify HTML has hurt the site's performance too much. I'll do some comparison of performance with and without Minify HTML but it looks like I might be able to live without it.

I see you've closed the issue. I'll reply again if I encounter any further related problems.

Thanks, Roman.

brandsis commented 1 month ago

Hi, Roman. I just wanted to confirm that removal of the Minify HTML plugin had no adverse impact on site performance, so forms are now working as intended. Thanks for your help.