solspace / craft-freeform

Freeform for Craft: The most reliable form builder that's ready for wherever your project takes you.
https://docs.solspace.com/craft/freeform/v5/
Other
47 stars 60 forks source link

Issue with field of type pattern not appearing in email template #960

Closed romainpoirier closed 10 months ago

romainpoirier commented 10 months ago

Describe the bug or issue you're experiencing

I encountered a problem with a field of type Pattern in my Admin email template.

Steps to reproduce

  1. Set up Craft CMS with the mentioned versions.
  2. Create a Freeform form that includes a field of type Pattern with the following value:
    ^[0]*[0-9]{2}[.\- ]{0,1}[0-9]{2}[.\- ]{0,1}[0-9]{2}[.\- ]{0,1}[0-9]{3}[.\- ]{0,1}[0-9]{2}$
  3. Configure an email notification in Freeform using the provided Admin email template below.

Admin Email Template Example:

{%
    for field in submission.fieldMetadata
    if field.type not in ['dynamic_recipients', 'hidden', 'multiple_select', 'rating', 'regex']
%}
    {% if field.type == 'file' %}
        {% set assetIds = attribute(submission, field.handle).value ?? [] %}
        {% if assetIds | length %}
            {%
                for assetId in assetIds
                if craft.assets.id(assetId).one() | length
            %}
                {% set asset = craft.assets.id(assetId).one() %}
                <a href="{{ asset.url }}" style="color:#000;text-decoration:none;">
                    {{ asset.filename | typogrify }}
                </a>
            {% endfor %}
        {% else %}
            {{ 'Blank' | t | typogrify }}
        {% endif %}
    {% else %}
        {{ '{value}' | t({ value: (field.valueAsString is not empty) ? field.valueAsString : 'Blank' | t }) | typogrify }}
    {% endif %}
{% endfor %}

User-Side Template Example:

{% for field in allFields %}
    {{ '{value}' | t({ value: (field.valueAsString is not empty) ? field.valueAsString : 'None' | t }) | typogrify }}
{% endfor %}
  1. Submit a form with data that should trigger the display of the field of type Pattern in the email.

Expected behavior

The field of type Pattern should appear in the Admin email template as it did before.

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

Additional context

I have verified that the field of type Pattern is not appearing in the Admin email template, and using allFields as suggested in the user-side template does not resolve the issue.

romainpoirier commented 10 months ago

Update: after removing the pattern value I can confirm that the field is still not present in the email notification, so maybe it's an issue with Pattern field.