5. 🧰 Protecting Non-Standard & Custom Forms

One of the most powerful features of the JaJuMa Honey Spam Anti-Spam extension is its ability to protect not just the default Magento forms, but any custom form in your store.
Whether you have a custom "Request a Quote" form, a specialized contact form, or a form added by another third-party extension, you can shield it from spam.

This process is intended for developers or advanced users comfortable with Magento's backend configuration and, potentially, its layout and template systems.

5.1 📝 Step 1: Configure the Form in the Backend

The first step is to create a new form configuration in the extension's settings.

  1. Navigate to JaJuMa -> Honey Spam Anti-Spam -> Honey Spam Forms.
  2. Click Add New Form.
  3. From the Form ID dropdown, select the Custom Form option. This will reveal three additional fields required for the integration.

JaJuMa Honey Spam Anti-Spam Extension Custom Form Config

Custom Form Configuration Fields

  • Custom Form ID:
    This is a unique identifier that you create.
    It acts as a bridge between the backend configuration and the code you will add to your frontend.
    Use a simple, descriptive, lowercase string with underscores (e.g., custom_quote_form).
  • Form in Layout:
    This field requires the full action name of the page where your form is located.
    For example, the standard contact page is contact_index_index.
    If your form appears on every page (e.g., in the footer), you can leave this blank.
    You can typically find this value using Magento's developer mode template path hints.
  • Action submit of Form:
    This is the full action name of the controller that processes the form submission.
    For example, the standard contact form submits to contact_index_post.
    You can find this value by inspecting the action attribute of the <form> tag in the HTML.

After filling out these fields, configure the rest of the spam protection settings (Honeypot, Time Check, Scoring, etc.) as you would for a standard form.

5.2 💻 Step 2: Implement the Code Snippet

With the backend configured, the final step is to add a small code snippet to your store's frontend.
This snippet renders the necessary hidden fields (like the honeypot) within your custom form's HTML.
You must ensure the actionNamespace in the snippet exactly matches the Custom Form ID you created in Step 1.

There are two methods for adding the snippet:

Option A: For Forms in CMS Blocks or Pages

If your form is embedded within a CMS Page or CMS Block, this is the easiest method.
Simply add the following block directive inside your form's content:

    {{block class='Magento\Framework\View\Element\Template' template='Jajuma_HoneySpam::honeyspam/honeyspam.phtml' actionNamespace='your_custom_form_id'}}

Option B: For Forms in Template (.phtml) Files

If your form is hardcoded into a theme or module's .phtml template file, you will need to add the following PHP code directly into the file, somewhere between the opening <form> and closing </form> tags.

    echo $this->getLayout()
              ->createBlock('Magento\Framework\View\Element\Template')
              ->setData('actionNamespace', 'your_custom_form_id')
              ->setTemplate('Jajuma_HoneySpam::honeyspam/honeyspam.phtml')
              ->toHtml();

Once the snippet is in place and your caches are cleared, the extension will begin protecting your custom form.

📞 Need Help?

Still have questions or need assistance with your setup? Our expert team is here to help. Please don't hesitate to contact our support team for personalized assistance.


Ready to stop spam for good?

The JaJuMa Honey Spam Anti-Spam is the all-in-one solution for a cleaner, more secure Magento store.


Find all you need to know and more valuable insights about Hyvä and Magento.
Expertly curated by JaJuMa:

🚀 Launch the JaJuMa Hyväverse

Your central resource for everything Hyvä.

Explore the Magento Metropolis!

Your central resource for everything Magento.



Do you find all information about us and our services?

thumb-up
thumb-down