@appstractdk/as-ajax-umbraco-form
v2.0.7
Published
This is a JS component that hooks to all the Umbraco Forms you have on the page and submits them with ajax. Returns and displays errors if any received form the server.
Downloads
13
Keywords
Readme
as-ajax-umbraco-form
This is a JS component that hooks to all the Umbraco Forms you have on the page and submits them with ajax. Returns and displays errors if any received form the server.
Setup:
Import the script in your Script.js
import AjaxUmbracoForm from '@appstractdk/as-ajax-umbraco-form';
The Umbraco Form container div should have a class of ".ajax-umbraco-form".
If we want for it to automatically mount we need to add the class ".automount".
Example:
<div class="form-with-sidebar-page-form-wrapper ajax-umbraco-form automount">
@umbraco.RenderMacro("renderUmbracoForm", new { FormGuid = Model.Form, mode = "script" })
</div>
If no auto-mount is desired, we can make a new instance by using the following:
new AjaxUmbracoForm(el, successTemplate)
Options
AjaxUmbracoForm(node, successTemplate)
node - a html node successTemplate - a html string template