2023-02-02 16:43:15 +00:00
|
|
|
# `ui:form` / `ui:form.get` / `ui:form.post` (string $method = "get", string $name = "", string $action = "", array $attributes = [])
|
2022-12-22 14:34:37 +00:00
|
|
|
|
2023-02-02 16:43:15 +00:00
|
|
|
A version exists also for unsupported methods (as of HTML5) on forms `ui:form.put` / `ui:form.patch` / `ui:form.delete`, which
|
2022-12-22 14:34:37 +00:00
|
|
|
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 :
|
|
|
|
|
|
|
|
```html
|
|
|
|
<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>
|
2023-02-02 19:38:20 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### Additional options
|
|
|
|
|
|
|
|
You can now remove the enctype attribute `no-enctype` or the CSRF token `no-csrf` using those option
|
|
|
|
on the form tag :
|
|
|
|
|
|
|
|
```html
|
|
|
|
{% ui:form.post.no-enctype.no-csrf "my.form" %} {% endform %}
|
|
|
|
```
|
|
|
|
|
|
|
|
and would render as such :
|
|
|
|
|
|
|
|
```html
|
|
|
|
<form class="ui-form" action="$action" method="$method">
|
|
|
|
</form>
|
2022-12-22 14:34:37 +00:00
|
|
|
```
|