{{ post_params }}

{{ post_params }}

Object containing all of the HTTP post parameters for the current page.


Specific parameters may be accessed using {{ request.post_params.parametername }} or {{ request.post_params['parameter-name'] }}.

You may also treat this object as a list containing all of the post parameters which may be iterated using a {% for %} loop. For more details, see the examples below:

Field Type Description
object_type string Will always be "post_params".
is_valid true/false True for post requests. False if the request is not a post request.
by_name object An object whose properties match the post parameters in the request, including post parameters with empty values and post parameters with multiple values. If a post parameter has multiple values, the value will be a list containing all of the values for that post parameter.
keys list A list of all of the post parameter names in the request.
count number The number of distinct post parameters in the request.
length number The total number of post parameters in the request. If there are post parameters with multiple values this number will be greater than count.


Getting post parameters

{% if request.post_params.is_valid %} {% assign var username = request.post_params['username'] %} {% assign var password = request.post_params['password'] %} {% if username is_valid and password is_valid %} {% auth login username password %} {% endif %} {% endif %} {% unless auth.logged_in %}

Could not log in

{% endunless %}

Loop Post Parameters


Post Parameters

{% for param in request.post_params %}
{% if request.post_params.by_name[param] is_list %}
    {% for value in request.post_params.by_name[param] %}
  • {{ value }}
  • {% endfor %}
{% else %} {{ request.post_params.by_name[param] }} {% endif %}
{% endfor %}