verbb / formie

The most user-friendly forms plugin for Craft CMS.
Other
93 stars 69 forks source link

Custom classes from themeConfig aren't being applied to error alerts #1781

Closed gregorydavidjenkins closed 3 months ago

gregorydavidjenkins commented 3 months ago

Describe the bug

I'm using the pre-made tailwind themeConfig examples from the documentation, with a few color and spacing changes. The alertSuccess classes are applied correctly, but the alertError classes are not applied correctly.

Steps to reproduce

  1. Create a form with a required field
  2. Use themeConfig to add classes to alertError
  3. They don't appear on the front-end

Form settings

Craft CMS version

5.0.0-RC1

Plugin version

3.0.0-beta.4

Multi-site?

No

Additional context

Oddly I am able to add other attributes to the alerts using the same syntax, for example an "id" or a "data-custom-attribute" of some sort.

engram-design commented 3 months ago

That does seem to be working for me correctly. Can you show me the output for the error and success alert? I'm also testing with the Tailwind config.

I get a:

<div class="rounded-md bg-red-50 border border-red-200 text-sm text-red-700 p-4 mb-4" role="alert" data-fui-alert="" data-fui-alert-error="">Couldn’t save submission due to errors.</div>
gregorydavidjenkins commented 3 months ago

Sure! Here is the relevant chunk from my themeConfig (mostly just Tailwind stuff from your example, maybe some small changes, can't remember).

alertError: {
    attributes: {
        id: 'test-id',
        class: 'bg-red-50 border border-red-200 text-sm text-red-700 p-4 mb-4',
    },
},

And the output is:

<div id="test-id" role="alert" data-fui-alert="" data-fui-alert-error="">Couldn’t save submission due to errors.</div>
gregorydavidjenkins commented 3 months ago

Success alerts are working as expected.

gregorydavidjenkins commented 3 months ago
<div class="bg-green-50 border border-green-200 text-sm text-green-700 p-4 mb-4" role="alert" data-fui-alert="" data-fui-alert-success="">Submission saved.</div>
engram-design commented 3 months ago

Ah, looks like this is for Ajax-forms. Should be fixed for the next release. To get this early, run composer require verbb/formie:"dev-craft-5 as 3.0.0-beta.4".

gregorydavidjenkins commented 3 months ago

Thanks!

engram-design commented 3 months ago

Fixed in 3.0.0-beta.5