How to render flash messages
Created 7 years ago by ayhamhsnI used to define an instance of a form builder and rendered its inputs in my structure. but when I want to render the flash messages comes from the response of form in case it success or there are some errors. this is what I have done :
<div class="contact-form f-san-light">
{% set form = form('contactus').to('hello@pixel38.com').get() %}
{{ form.open({'class' : 'contact-form', 'id' : 'main-contact-form'}) |raw }}
<div class="form-group wow fadeInLeft mar9">
{{ form.fields.name.input |raw }}
</div>
<div class="form-group wow fadeInLeft mar9">
{{ form.fields.company_name.input |raw }}
</div>
<div class="form-group drop wow fadeInLeft mar9">
{{ form.fields.country.input |raw }}
</div>
<div class="form-group wow fadeInLeft mar30">
{{ form.fields.address.input |raw }}
</div>
<div class="form-group wow fadeInLeft mar9">
{{ form.fields.mobile_number.input |raw }}
</div>
<div class="form-group wow fadeInLeft mar30">
{{ form.fields.email.input |raw }}
</div>
<div class="form-group drop wow fadeInLeft mar9">
{{ form.fields.subject.input |raw }}
</div>
<div class="form-group wow fadeInLeft mar9">
{{ form.fields.message.input |raw }}
</div>
<div class="form-group wow fadeInLeft">
<button type="submit" class="submit btn primary-color-background f-header-bold">SUBMIT</button>
</div>
{{ form.close |raw }}
</div>
jcastillotx
—
7 years ago
There is a notification partial in the template you can use. Just call it in the twig.
An example of multiple types of messages can be found in
/core/pyrocms/starter-theme/resources/views/partials/messages.twig