wiki-grav/plugins/form/templates/forms/layouts/xhr.html.twig

8 lines
352 B
Twig
Raw Normal View History

{% if form.xhr_submit == true %}
{% do assets.addJs('plugin://form/assets/xhr-submitter.js', {'group': 'bottom', 'position': 'before'}) %}
{% do assets.addInlineJs("
document.addEventListener('DOMContentLoaded', () => {
attachFormSubmitListener('" ~ form.id ~ "');
});",
{'group': 'bottom', 'position': 'before'}) %}
{% endif %}