forms.js 636 B

1234567891011121314151617181920
  1. $(function () {
  2. if (typeof window.GravJS === 'undefined' || !window.GravJS.Form) {
  3. console.warn('Dependencies for Grav Forms are not loaded.');
  4. return;
  5. }
  6. // Register all FormFields that were loaded
  7. if (typeof window.GravJS.FormFields === 'object') {
  8. for (var key in window.GravJS.FormFields) { if (window.GravJS.FormFields.hasOwnProperty(key)) {
  9. GravJS.Form.registerFactory(GravJS.FormFields[key]);
  10. }
  11. }
  12. }
  13. window.formInstances = [];
  14. $('[data-grav-form]').each(function () {
  15. window.formInstances.push(new GravJS.Form($(this)));
  16. })
  17. });