octobercmsoctobercms-plugins

October CMS, I can't make Subscribe form by Magic forms plug-in


I have a October CMS setup and I have a Subscribe form in footer.

Footer is a default.htm' partial into Layouts.

I override Generic Ajax Form html with a partial, it's path partials\subscribe\default.htm and I include it into Footer.

And I try to create Generic Ajax Form into Layouts\default.htm and Footer (site\footer.htm) but Ajax handler is not found.

It gave me this message:

AJAX handler 'subscribe::onSubscribeSubmit' was not found.

My site tree:

Layouts\default.htm (I've tried here to setup Magic Forms but it not handle)

...
...
{% partial 'site/footer' %}
...

site\footer.htm (I've tried here to setup Magic Forms but it not handle)

...
...
{% component "subscribe" %}
...

partials\subscribe\default.htm

<div class="footer-top">
  <div class="container">
    <div class="row">
      <div class="col text-md-left">
        <div class="fs-24px fw-600 text-white mb-16">
          Sign up for our newsletter
        </div>
        <form class="subscribe-form w-100 mw-500px" data-request="{{ __SELF__ }}::onSubscribeSubmit">
            {{ form_token() }}
            <div id="{{ __SELF__ }}_forms_flash"></div>
          <div class="form-group d-flex">
            <input type="text" name="email" class="form-control rounded-left font-roboto" placeholder="Enter email address">
            <button type="submit" class="form-control submit font-roboto fs-16px fw-700">
              <span>Sign Up</span>
            </button>
          </div>
        </form>
      </div>
    </div>
  </div>
</div>

Solution

  • I guess you should be using {{ __SELF__ }}::onFormSubmit handler instead of {{ __SELF__ }}::onSubscribeSubmit.

    from the plugin's perspective, there is no such event handler onSubscribeSubmit.

    You can use {{ __SELF__ }}::onFormSubmit handler for Generic Ajax Form.

    if any doubts please comment.