model_form

Description

Display the form html tag with the appropriate hidden fields in order to create a content entry from a public site. It handles callbacks, csrf and target url out of the box.

This tag requires Wagon 1.5+ and LocomotiveCMS 2.5.5+

Syntax

{% model_form <your model>, <options> %}<your html form>{% endform_form %}

Examples

{% model_form 'newsletter_addresses' %}
  <input type='text' name='content[email]' />
  <input type='submit' value='Add' />
{% endform_form %}

With options:

{% model_form 'newsletter_addresses', class: 'a-css-class', success: '/welcome', error: '/error' %}
  <input type='text' name='content[email]' />
  <input type='submit' value='Add' />
{% endform_form %}
© 2024 LocomotiveCMS Terms of use Privacy Policy
Back to top