solspace / craft-express-forms

Express Forms for Craft: Intuitive and lightweight form builder that gets the job done but doesn’t get in your way.
https://docs.solspace.com/craft/express-forms/v2/
Other
13 stars 4 forks source link

Submissions not working Craft 4 upgrade #124

Open clarknelson opened 7 months ago

clarknelson commented 7 months ago

Describe the bug or issue you're experiencing

I upgraded craft and express forms to the latest versions, now my contact form won't track submissions.

Everything looks okay on the front-end, I double checked that everything matched the recommended syntax in the docs. The only thing is when I go to submissions theres nothing there. I tried duplicating the form as well but no luck at all. Any ideas where to turn? No console messages, etc.

Craft & Plugin Info (please complete the following information):

Additional context

I can email database / logs if needed.

Thank you!

kjmartens commented 7 months ago

Hi @clarknelson,

What do you mean by "won't track submissions"? Won't save the submission data to the database, or won't send email notifications? 🙂

What does your email notification template look like? If you're using the old way of grabbing the system email address and name, you'll need to update that to use the projectConfig approach instead:

fromName: '{{ craft.app.projectConfig.get("email.fromName") }}'
fromEmail: '{{ craft.app.projectConfig.get("email.fromEmail") }}'
clarknelson commented 7 months ago

This is what the current notification template looks like:

CleanShot 2024-03-16 at 22 35 36@2x

I tried to update to the suggested syntax but there's still no submissions appearing in the dashboard:

CleanShot 2024-03-16 at 22 39 40@2x

Here's the whole form if you think there might be a syntax issue:


        {% if form.submittedSuccessfully %}
            <div class="success message">Thanks for getting in touch!</div>
        {% endif %}

        {% if not form.valid %}
            <div class="failure message">
                Sorry, there was an error.
                {% if form.errors|length %}
                    <ul>
                        {% for error in form.errors %}
                            <li>{{ error|t }}</li>
                        {% endfor %}
                    </ul>
                {% endif %}
            </div>
        {% endif %}

        {{ form.openTag({
            attributes: {
                id: 'ajax-form',
            },
            return: '/#contact-form',
            template: '_notifications/admin.twig'
        }) }}

        <div class="row">
            <input type="text" name="firstName" placeholder="First Name*" value="{{ form.fields.firstName.value }}" required/>
            {{ forms.renderErrors(form.fields.firstName) }}
            <input type="text" name="lastName" placeholder="Last Name*" value="{{ form.fields.lastName.value }}" required/>
            {{ forms.renderErrors(form.fields.lastName) }}
        </div>
        <input type="email" name="email" placeholder="E-mail*" value="{{ form.fields.email.value }}" required/>
        {{ forms.renderErrors(form.fields.email) }}
        <input type="text" name="subject" placeholder="Subject*" value="{{ form.fields.subject.value }}" required/>
        {{ forms.renderErrors(form.fields.subject) }}
        <textarea type="text" name="message" placeholder="I dream of marshmallows..." rows="5">{{ form.fields.message.value }}</textarea>
        {{ forms.renderErrors(form.fields.message) }}
        {# {{ form.recaptcha.render }} #}

        {# {{ forms.renderErrors(form.recaptcha) }} #}
        <button class="button submit" type="submit">Submit</button>

        {# Form Contents #}
        {{ form.closeTag }}

        {% include "includes/_formAjax" %}
eheiser commented 4 months ago

I have exactly the same issue. I'll be replacing it by Freeform pro asap.