diff --git a/templates/_components/form.twig b/templates/_components/form.twig index 9ca61ce..6684fc2 100644 --- a/templates/_components/form.twig +++ b/templates/_components/form.twig @@ -1,12 +1,14 @@ +{% set id = handle ~ '-' ~ random(1000, 9999) %} + {% set baseOptions = { - id: handle + id: id } %} {% if options is defined %} {% set baseOptions = baseOptions|merge(options) %} {% endif %} -
+
{% set form = craft.freeform.form( handle, @@ -21,9 +23,9 @@ document.addEventListener('alpine:init', () => { Alpine.data('form', () => ({ - dynamicForm(handle) { + dynamicForm(handle, id) { - form = document.getElementById(handle); + const form = document.getElementById(id); fetch( '{{ siteUrl }}dynamic/form?form=' + handle