Questions

Place this form anywhere on the page.

<form method="post" accept-charset="UTF-8">
    {{ csrfInput() }}
    {{ actionInput('qarr/questions/save') }}
    {{ redirectInput('question-posted') }}

    <input type="hidden" name="elementId" value="modelId">
    
    {% if currentUser %}
        <input type="hidden" name="currentUser" value="userId">
    {% endif %}

    <div>
        <label>Full Name</label>
        <input type="text" name="fields[fullName]" placeholder="Full Name" required>
    </div>

    <div>
        <label>Email Address</label>
        <input type="text" name="fields[emailAddress]" placeholder="Email Address" required>
    </div>

    <div>
        <label>Question</label>
        <textarea name="fields[question]" cols="30" rows="10" placeholder="Your question"></textarea>
    </div>

    <button class="sumit">Submit</button>
</form>

Attributes

  • modelId - Replace with your entrys id. eg. entry.id
  • userId - Replace with currentUser id. eg. currentUser.id

Errors

Any form validation errors can be displayed like this:

<form method="post" accept-charset="UTF-8">
   ...

   {% if errors is defined %}
        <ul>
            {% for error in errors %}
                <li>{{ error[0] }}</li>
            {% endfor %}
        </ul>
    {% endif %}
        
    <button class="sumit">Submit</button>
</form>