• Resolved derekbolger2022

    (@derekbolger2022)


    Hi All,

    I have a newsletter sign up form (simple form only 1 input requesting email)

    On some pages the form is present 2 to 3 times (twig template form), my problem is when I submit one the others submit also. I have read the docs regarding a unique key but I’m not sure I have added this key correctly. Below is the code for the form, any help would be appreciated.

    [msdyncrm_twig]
    {% form entity="tek__newsandarticle" mode="create" required=["tek__email"] messages={ "success": "Form submitted.", "error": "Submission failed."} key="main-form" %}
    <form method="POST">
       
        <input class="newsletter-input" name="tek__email" required placeholder="Email">
       
        <button class="newsletter-submit-button" type="submit">Subscribe to our Newsletter</button>
       
        <input type="hidden" name="_key" value="{{form.key}}">
       
        {% if form.submission and form.status %}
          <div class="row twig-success-message">
            <div class="col-12">
              <div class="alert alert-success">
                {{ form.parameters.messages.success ?? "You have been subscribed. Thank you!" }}
              </div>
            </div>
          </div>
        {% elseif form.submission and (not form.status) %}
          <div class="row twig-error-message">
            <div class="col-12">
              <div class="alert alert-danger">
                {% if form.parameters.messages.error %}
                  {{ form.parameters.messages.error }}
                {% else %}
                  {% for descriptor, message in form.errors %}
                    <div>{{ message|join(', ') }}</div>
                  {% endfor %}
                {% endif %}
              </div>
            </div>
          </div>
        {% endif %}
       
    </form>
    {% endform %}
    [/msdyncrm_twig]

    We are just testing the free version before we decide to use it and would be buying the premium version and also implementing it on a few other projects ??.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author alexacrm

    (@alexacrm)

    Hi @derekbolger2022,

    I believe we have no way of differentiating between the form submissions when the page is POSTed back. Hence that hidden key. Are you getting the key value in the submission? That’d be the way to differentiate between the form instances and drop those that do not apply. Can you point us to the page (if it’s public) containing the rendered forms? If not, can you reply with HTML that gets produced for the forms (both instances).

    We do have slightly different way of generating forms in our newer, better Dataverse plugin. If you’re just starting, I recommend taking a look at that as this is our forward-looking primary plugin. It’s a new version written from scratch, and it’s based on Web API (as opposed to SOAP). And it does have much more capable premium addons as well.

    Thanks

    Thread Starter derekbolger2022

    (@derekbolger2022)

    @alexacrm cheers. ?? I’ve gotten in working in the interim with no duplicate submissions. Just now the form is being hit with spam, even with a spam filter/firewall running that protects all the other forms on the site flawlessly, even other custom forms.

    Website Link

    I will check out the new plugin in a safe staging/dev environment as I see it uses a recaptcha v3 which may be the answer to the spam issue we’re facing now. It’s just a simple email capture for our newsletter so we didn’t want to include a captcha on it as it may dissuade users from signing up but the v3 captcha may be the answer as it would only be triggered if it suspects a bot ??

    We are a Microsoft partnered company so I’m sure our Power apps devs can find a solution and if successful will utilise your new plugin elsewhere.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Dynamics 365 plugin 2 identical forms on the same page’ is closed to new replies.