DmitrMakeev commited on
Commit
74e0ceb
·
verified ·
1 Parent(s): 92e06bc

Update pages.html

Browse files
Files changed (1) hide show
  1. pages.html +15 -5
pages.html CHANGED
@@ -468,7 +468,7 @@ editor.Blocks.add('custom-form', {
468
  label: 'Custom Form',
469
  content: `
470
  <div class="form-container container">
471
- <form id="contactForm" class="conForm" data-avp="" data-grups="" data-redirect="">
472
  <h4>КЛУБ-ПРАКТИК. 255 техник для психолога - 2024</h4>
473
  <div class="form-group name-field">
474
  <label for="name">Имя</label>
@@ -591,7 +591,7 @@ editor.DomComponents.addType('privacy-policy-link', {
591
  },
592
  });
593
 
594
- // Добавляем возможность настройки атрибутов формы
595
  editor.DomComponents.addType('custom-form', {
596
  model: {
597
  defaults: {
@@ -628,10 +628,20 @@ editor.on('component:update', function(component) {
628
  const avp = component.get('attributes').avp || '';
629
  const grups = component.get('attributes').grups || '';
630
  const redirect = component.get('attributes').redirect || '';
 
 
 
 
 
 
 
631
  const form = document.getElementById('contactForm');
632
- form.setAttribute('data-avp', avp);
633
- form.setAttribute('data-grups', grups);
634
- form.setAttribute('data-redirect', redirect);
 
 
 
635
  }
636
  });
637
 
 
468
  label: 'Custom Form',
469
  content: `
470
  <div class="form-container container">
471
+ <form id="contactForm" class="conForm">
472
  <h4>КЛУБ-ПРАКТИК. 255 техник для психолога - 2024</h4>
473
  <div class="form-group name-field">
474
  <label for="name">Имя</label>
 
591
  },
592
  });
593
 
594
+ // Добавляем возможность настройки переменных формы
595
  editor.DomComponents.addType('custom-form', {
596
  model: {
597
  defaults: {
 
628
  const avp = component.get('attributes').avp || '';
629
  const grups = component.get('attributes').grups || '';
630
  const redirect = component.get('attributes').redirect || '';
631
+
632
+ // Используем переменные в JavaScript
633
+ console.log('AVP:', avp);
634
+ console.log('GRUPS:', grups);
635
+ console.log('REDIRECT:', redirect);
636
+
637
+ // Пример использования переменных
638
  const form = document.getElementById('contactForm');
639
+ form.addEventListener('submit', function(event) {
640
+ event.preventDefault();
641
+ if (redirect) {
642
+ window.location.href = redirect;
643
+ }
644
+ });
645
  }
646
  });
647