Template Tags

You can use the following template tag to manually create a Snaptcha field (not required for supported add-ons):

{exp:snaptcha:field}

Creates a Snaptcha field with the security level in the extension settings

{exp:snaptcha:field security_level="1"}

Creates a Snaptcha field with the security level specified (1=low, 2=medium, 3=high)

If you have a situation where you are using the Snaptcha field multiple times in the same template then you should give each tag a unique identifier.

{exp:snaptcha:field id="1"}

{exp:snaptcha:field id="2"}

{exp:snaptcha:field id="3"}

The field tag also accepts any extra parameters and assigns them as html attributes. For example:

{exp:snaptcha:field required="yes" aria-description="foo" data-something="123"}

Will result in the following output. Note that a boolean value of true ("1", "yes" or "true") will result in just the attribute added to the tag. A boolean value of false ("0", "no" or "false") will not add the attribute to the input tag.

<input type="text" name="snap" id="snap" value="[random string]" required aria-description="foo" data-something="123" />

AJAX Forms #

If your forms use AJAX to submit data then you must ensure that the Snaptcha field and its corresponding value is submitted as well.

Last updated