Skip to content

Instantly share code, notes, and snippets.

@0xcrypto
Created March 12, 2023 14:53
Show Gist options
  • Save 0xcrypto/3b52315e4829ddcfb446d20096bc4ef8 to your computer and use it in GitHub Desktop.
Save 0xcrypto/3b52315e4829ddcfb446d20096bc4ef8 to your computer and use it in GitHub Desktop.
Test page script
{% macro errorList(errors) %}
{% if errors %}
<ul class="errors">
{% for error in errors %}
<li>{{ error }}</li>
{% endfor %}
</ul>
{% endif %}
{% endmacro %}
{% from _self import errorList %}
<form method="post" accept-charset="UTF-8" enctype="multipart/form-data">
{{ csrfInput() }}
<input type="hidden" name="action" value="guest-entries/save">
<input type="hidden" name="sectionId" value="2">
<input type="hidden" name="enabled" value="1">
{{ redirectInput('{uri}') }}
<label for="title">Title</label>
<input id="title" type="text" name="title"
{%- if entry is defined %} value="{{ entry.title }}"{% endif -%}>
{% if entry is defined %}
{{ errorList(entry.getErrors('title')) }}
{% endif %}
<input type="file" name="fields[asset]">
<input type="submit" value="Publish">
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment