Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Front end output entries and custom templates #25

Closed
noregt opened this issue Nov 12, 2015 · 4 comments
Closed

Front end output entries and custom templates #25

noregt opened this issue Nov 12, 2015 · 4 comments

Comments

@noregt
Copy link

noregt commented Nov 12, 2015

Two 'issues' using your excellent form:
• I'm missing the frontend code to display entries. Is that possible? Or no web page entries output?
• Also examples of the custom templates to adapt the html and css I would be useful (form.html, field.html etc)

@noregt
Copy link
Author

noregt commented Nov 12, 2015

Found the second answer to custom templates in the archived issues: copying craft/plugins/amforms/templates/_display/templates to the custom folder works.

@hubertprein
Copy link
Contributor

You can use the variable functions for that, just as you would display a form. If you use the submissions (get a criteria model) or getSubmissionById (when you know the exact ID..) function, one could get the submission data, which you could display on the frontend.

With the code below you can get multiple submissions, based on a form handle.

{# Get submissions (100 by default, Craft functionality) #}
{% set submissions = craft.amForms.submissions({
    formHandle: 'yourFormHandleHere'
}) %}

{% for submission in submissions %}
    <h1>{{ submission.title }}</h1>

    <p>{{ submission.fieldHandleOne }}</p>
    <p>{{ submission.fieldHandleTwo }}</p>
    <p>{{ submission.fieldHandleEtc }}</p>
{% endfor %}


{# Limit the submissions #}
{% set submissions = craft.amForms.submissions({
    formHandle: 'yourFormHandleHere',
    limit: 10
}) %}
{# or #}
{% set submissions = craft.amForms.submissions.formHandle('yourFormHandleHere').limit(10) %}


{# Get latest #}
{% set submission = craft.amForms.submissions.formHandle('yourFormHandleHere').last() %}


{# Get total #}
{% set submissions = craft.amForms.submissions.formHandle('yourFormHandleHere').total() %}

@noregt
Copy link
Author

noregt commented Jan 2, 2016

Thanks Hubert!

@nunocarrico
Copy link

Hello! Is possible to show a file submited from a form in frontend? I can display other fields (name, email, etc).

Thank you for your great work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants