4

Looking at the Magento Contact Module (be it magento1 or magento2) there is a hidden field name="hideit".

<input type="hidden" name="hideit" id="hideit" value="" />

Here the full snippet from magento2:

<div class="actions-toolbar">
    <div class="primary">
        <input type="hidden" name="hideit" id="hideit" value="" />
        <button type="submit" title="<?php /* @escapeNotVerified */ echo __('Submit') ?>" class="action submit primary">
            <span><?php /* @escapeNotVerified */ echo __('Submit') ?></span>
        </button>
    </div>
</div>

However, apart from being in the post validation, this field does not seem to be used anywhere in the code.

if (\Zend_Validate::is(trim($post['hideit']), 'NotEmpty')) {
    $error = true;
}

What is it used for?

3

I reckon it's the same use as it was back in M1.

If I remember right it was introduced around 1.4 to prevent spam.

As you can see from the controller part you pasted, it will throw an error if this field is not empty.

Robots are used to fill every input tag of the form, including hidden input tags.

If that field is not empty, that means a robot has filled the form.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.