picea-ui/docs/10-ui-form.md

1.0 KiB

ui:form / ui:form.get / ui:form.post (string $method = "get", string $name = "", string $action = "", array $attributes = [])

A version exists also for unsupported methods (as of HTML5) on forms ui:form.put / ui:form.patch / ui:form.delete, which could find a use within a Javascript environment.

The following attributes are assigned by this extension :

  • 'class' => "ui-form"
  • 'enctype' => "multipart/form-data"
  • 'method' => "get|post|put|patch|delete"

and will typically be rendered such as :

<form class="ui-form" enctype="multipart/form-data" action="$action" method="$method">
    <input class="ui-hidden" type="hidden" name="picea-ui-form[$name]" value="{ random md5 hash }">
</form>

Additional options

You can now remove the enctype attribute no-enctype or the CSRF token no-csrf using those option on the form tag :

{% ui:form.post.no-enctype.no-csrf "my.form" %} {% endform %}

and would render as such :

<form class="ui-form" action="$action" method="$method">
</form>