Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions app/assets/js/widget-formGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@

// Setup the loaded form with ufForm
$('#' + box_id).find("form").ufForm({
validators: validators,
validator: validators,
msgTarget: $("#"+box_id+" #form-alerts")
})
.on("submitSuccess.ufForm", $.proxy(this._formPostSuccess, this, box_id, button))
Expand Down Expand Up @@ -348,8 +348,4 @@
}
};

// Apply on default selector
$(".js-displayForm").formGenerator();
$(".js-displayConfirm").formGenerator('confirm');

})(jQuery, window, document);
})(jQuery, window, document);
2 changes: 1 addition & 1 deletion app/templates/FormGenerator/modal.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<!-- Need to reload and reaply those since we're in modal -->
<script>
// Load the validator rules for this form
var validators = {{validators|default('{}')| raw}};
var validators = {{validators|default('{}')| json_encode(constant('JSON_PRETTY_PRINT')) | raw}};

$(function() {
$('#{{box_id}}').iCheck({
Expand Down
6 changes: 6 additions & 0 deletions public/templates/pages/formgenerator.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,10 @@
{% block scripts_page %}
<!-- Include page-specific JS -->
{{ encore_entry_script_tags('widget.formGenerator') }}

<script>
// Initialize form generator here instead of the plugin file
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the issue with the current way it's done?

$(".js-displayForm").formGenerator();
$(".js-displayConfirm").formGenerator("confirm");
</script>
{% endblock %}