Skip to content
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

Forms don't have correct Formatting after validation #1607

Closed
valboivin opened this issue Nov 5, 2024 · 2 comments · Fixed by #1637
Closed

Forms don't have correct Formatting after validation #1607

valboivin opened this issue Nov 5, 2024 · 2 comments · Fixed by #1637
Assignees
Labels
issue Something isn't working correctly

Comments

@valboivin
Copy link

What happened?

If we have multiple forms on a same page, the first one will always be ok. However, the subsequent ones won't have the same correct formatting once we try to submit them. The default templating we use for our forms is "Bootstrap 5". This is also the same one we use for every form we have created on our website.

For example, if we try to send a form with empty required fields, we expect the class is-invalid to be added to the incorrect fields. Right now, it is the case only on the first form, but not on the other ones (which are all setup the same way and using the same rendering twig template). It is not the only problematic class. It looks like the validated form looses its Bootstrap formatting overrides.

We've tried to fix this by overriding the render method to manually add the error class to no avail. Something odd is that if we look into the Network tab, the response object has the expected classes in its html property.

We've been using Freeform for a couple of years already, and we didn't have problem with the default framework formatting before. We've tested with the different versions, and those before 5.6.0 don't have this bug. It seems like something has changed in the 5.6.0 version.

Errors and Stack Trace (if available)

No response

How can we reproduce this?

  1. Add multiple forms with the Bootstrap 5 templating on the same page
  2. Try to submit the forms with invalid/empty fields
  3. The first form will have the is-invalid class on its invalid fields and the other forms will have the freeform-has-errors class on its invalid fields.

Freeform Edition

Pro

Freeform Version

5.6.4

Craft Version

5.4.9

When did this issue start?

After upgrading from older Freeform version

Previous Freeform Version

5.5.10

@valboivin valboivin added the issue Something isn't working correctly label Nov 5, 2024
@kjmartens
Copy link
Contributor

I'm sorry for the delay and the trouble you're experiencing @valboivin,

I'll have a developer check into this and get back to you shortly. 🙂

@kjmartens
Copy link
Contributor

This should now be resolved in Freeform 5.7.2+ 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue Something isn't working correctly
3 participants