# Template Tags

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

{% tabs %}
{% tab title="EE Template" %}

```
{exp:snaptcha:field}
```

{% endtab %}

{% tab title="Twig" %}

```twig
{% set snaptcha = exp.snaptcha.field() %}
{{ snaptcha | raw }}
```

{% endtab %}
{% endtabs %}

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.

```html
{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:

```html
{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.

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

### AJAX Forms [#](https://putyourlightson.com/plugins/snaptcha-ee#ajax-forms) <a href="#ajax-forms" id="ajax-forms"></a>

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.boldminded.com/snaptcha/docs/template-tags.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
