Skip to content

Instantly share code, notes, and snippets.

@tridoan
tridoan / .gitignore
Created May 8, 2020 04:53 — forked from SaltwaterC/.gitignore
php cache curl
/cache/
@tridoan
tridoan / calderaforms.ajax-success.js
Created May 7, 2020 21:39 — forked from danieliser/calderaforms.ajax-success.js
Caldera Forms doesn't provide any events on the form itself when AJAX is successful (no validation errors). Thus the workaround is to store the form at the last event triggered where it is accessible `cf.ajax.request`, and use it in either the global `cf.submission` or `cf.complete` events.
{
const $ = window.jQuery;
let currentForm, currentFormId;
$(document)
// Before all requests
.on('cf.ajax.request', function (event, obj) {
currentForm = obj.$form;
currentFormId = obj.formIdAttr;
})