diff --git a/contactsnew/class.contactsnew.php b/contactsnew/class.contactsnew.php index f332511..427faba 100755 --- a/contactsnew/class.contactsnew.php +++ b/contactsnew/class.contactsnew.php @@ -890,8 +890,10 @@ class ContactsNew // если выбрана демоформа jQuery Validation Plugin и reCAPTCHA v3 if ($_REQUEST['demo'] == 'jqval_cap') { include(BASE_DIR . '/modules/contactsnew/demo/demo_jqval.php'); + } elseif ($_REQUEST['demo'] == 'ajax_jqval_cap') { + include(BASE_DIR . '/modules/contactsnew/demo/demo_ajax_jqval.php'); } else { - include(BASE_DIR . '/modules/contactsnew/demo/demo.php'); + include(BASE_DIR . '/modules/contactsnew/demo/demo.php'); } $_REQUEST = array_merge($_REQUEST,$demo); // обновляем форму с данными примера @@ -903,6 +905,10 @@ class ContactsNew // подставляем в шаблон новые значения атрибутов name $demo['form_tpl'] = preg_replace_callback('/form-jqval_cap\[(\d+)]/', create_function('$matches','return "form-jqval_cap[" . $_REQUEST["demo_change"][(int)$matches[1]] . "]";'),$demo['form_tpl']); } + if ($_REQUEST['demo'] == 'ajax_jqval_cap') { + // подставляем в шаблон новые значения атрибутов name + $demo['form_tpl'] = preg_replace_callback('/form-ajax_jqval_cap\[(\d+)]/', create_function('$matches','return "form-ajax_jqval_cap[" . $_REQUEST["demo_change"][(int)$matches[1]] . "]";'),$demo['form_tpl']); + } $AVE_DB->Query(" UPDATE " . PREFIX . "_module_contactsnew_forms SET diff --git a/contactsnew/demo/demo_ajax_jqval.php b/contactsnew/demo/demo_ajax_jqval.php new file mode 100644 index 0000000..ce60c8e --- /dev/null +++ b/contactsnew/demo/demo_ajax_jqval.php @@ -0,0 +1,312 @@ + +'
+
+
+

Демо интеграции в Модуль Контакты New v1.2.5

jQuery Validation Plugin   и   reCAPTCHA v3

+
+
+ Если форма не работает, или не работает валидация (отправляется пустая форма без проверки и т.п.) убедитесь, что библиотека jQuery (jquery.min.js - по умолчанию подключается модулем) подключена на странице только один раз! и расположена в секции <head> , а также подключен скрипт jquery.form.min.js (по умолчанию подключается модулем в разделе Скрипты и стили, необходимые для оформления и функционирования формы) + +
+
+
+
+

[tag:formtitle]

+
+
+
+[tag:fld:email] +[tag:fld:subject] +[tag:fld:6] +[tag:fld:7] +[tag:fld:8] +[tag:fld:9] +
+
+ +
+
+
+
+
+
+ +' +); + +$demo = array( + 'alias' => 'ajax_jqval_cap', + 'title' => 'Демо форма с Ajax, jQuery Validation Plugin и reCAPTCHA v3', + 'mail_set' => array( + 'from_name' => '', + 'from_email' => '', + 'subject_tpl' => '[tag:fld:subject]', + 'receivers' => array( + array( + 'email' => '', + 'name' => '' + ) + ), + 'format' => 'text', + ), + 'rubheader' => ' + + + +', + 'form_tpl' => $form_tpl[$_REQUEST['demo']], + 'mail_tpl' => '[tag:easymail]', + 'finish_tpl' => '
+ Форма успешно отправлена! Обновить страницу +
+', + 'code_onsubmit' => '', + 'code_onvalidate' => '', + 'code_onsend' => '', + 'fields' => array( + 1 => array( + 'new' => true, + 'form_id' => $fid, + 'title' => 'email', + 'active' => 1, + 'type' => 'input', + 'main' => 1, + 'setting' => '', + 'required' => 0, + 'defaultval' => '', + 'attributes' => 'id="fld[[tag:id]]" class="form-control" placeholder="[tag:title]"', + 'tpl' => '
+ +
+[tag:fld] +
+
' + ), + 2 => array( + 'new' => true, + 'form_id' => $fid, + 'title' => 'subject', + 'active' => 1, + 'type' => 'input', + 'main' => 1, + 'setting' => '', + 'required' => 0, + 'defaultval' => '', + 'attributes' => 'id="fld[[tag:id]]" class="form-control" placeholder="[tag:title]"', + 'tpl' => '
+ +
+[tag:fld] +
+
' + ), + 3 => array( + 'new' => true, + 'form_id' => $fid, + 'title' => 'receivers', + 'active' => 0, + 'type' => 'select', + 'main' => 1, + 'setting' => '', + 'required' => 0, + 'defaultval' => 0, + 'attributes' => '', + 'tpl' => '' + ), + 4 => array( + 'new' => true, + 'form_id' => $fid, + 'title' => 'copy', + 'active' => 0, + 'type' => 'checkbox', + 'main' => 1, + 'setting' => '', + 'required' => 0, + 'defaultval' => 1, + 'attributes' => '', + 'tpl' => '' + ), + 5 => array( + 'new' => true, + 'form_id' => $fid, + 'title' => 'captcha', + 'active' => 0, + 'type' => 'input', + 'main' => 1, + 'setting' => '', + 'required' => 1, + 'defaultval' => '', + 'attributes' => '', + 'tpl' => '' + ), + 6 => array( + 'new' => true, + 'form_id' => $fid, + 'title' => 'Никнейм', + 'active' => 1, + 'type' => 'input', + 'main' => 0, + 'setting' => '', + 'required' => 0, + 'defaultval' => '', + 'attributes' => 'id="fld[[tag:id]]" class="form-control" placeholder="[tag:title]"', + 'tpl' => '
+ +
+[tag:fld] +
+
' + ), + 7 => array( + 'new' => true, + 'form_id' => $fid, + 'title' => 'Текст сообщения', + 'active' => 1, + 'type' => 'textarea', + 'main' => 0, + 'setting' => '', + 'required' => 0, + 'defaultval' => '', + 'attributes' => 'id="fld[[tag:id]]" class="form-control" placeholder="[tag:title]"', + 'tpl' => '
+ +
+[tag:fld] +
+
' + ), + 8 => array( + 'new' => true, + 'form_id' => $fid, + 'title' => 'Работа чекбокса', + 'active' => 1, + 'type' => 'checkbox', + 'main' => 0, + 'setting' => '', + 'required' => 0, + 'defaultval' => '', + 'attributes' => 'id="fld[[tag:id]]" value="agree"', + 'tpl' => '
+
+
+ +
+
+
' + ), + 9 => array( + 'new' => true, + 'form_id' => $fid, + 'title' => 'Оценка отправителя формы сервисом reCAPTCHA', + 'active' => 1, + 'type' => 'input', + 'main' => 0, + 'setting' => '', + 'required' => 0, + 'defaultval' => '', + 'attributes' => 'id="hidden_fld_[tag:formalias]" type="hidden"', + 'tpl' => '[tag:fld]' + ) + + + ) +); \ No newline at end of file diff --git a/contactsnew/lang/bg.txt b/contactsnew/lang/bg.txt index 63d1e3e..ed45f7a 100644 --- a/contactsnew/lang/bg.txt +++ b/contactsnew/lang/bg.txt @@ -183,4 +183,5 @@ found_key_recap_v3 = "В системных настройках обнаруж notfound_key_recap_v3_1 ="API ключи reCAPTCHA v3 не обнаружены." notfound_key_recap_v3_2 =" Вы можете установить их в разделе " notfound_key_recap_v3_3 ="Системные настройки" -demo_jqval_cap = "с jQuery Validation Plugin и reCAPTCHA v3" \ No newline at end of file +demo_jqval_cap = "Без Ajax, с jQuery Validation Plugin и reCAPTCHA v3" +demo_ajax_jqval_cap = "Ajax, с jQuery Validation Plugin и reCAPTCHA v3" \ No newline at end of file diff --git a/contactsnew/lang/en.txt b/contactsnew/lang/en.txt index 7325ecb..c803440 100644 --- a/contactsnew/lang/en.txt +++ b/contactsnew/lang/en.txt @@ -183,4 +183,5 @@ found_key_recap_v3 = "В системных настройках обнаруж notfound_key_recap_v3_1 ="API ключи reCAPTCHA v3 не обнаружены." notfound_key_recap_v3_2 =" Вы можете установить их в разделе " notfound_key_recap_v3_3 ="Системные настройки" -demo_jqval_cap = "с jQuery Validation Plugin и reCAPTCHA v3" \ No newline at end of file +demo_jqval_cap = "Без Ajax, с jQuery Validation Plugin и reCAPTCHA v3" +demo_ajax_jqval_cap = "Ajax, с jQuery Validation Plugin и reCAPTCHA v3" \ No newline at end of file diff --git a/contactsnew/lang/ru.txt b/contactsnew/lang/ru.txt index d49d40a..0e1e711 100644 --- a/contactsnew/lang/ru.txt +++ b/contactsnew/lang/ru.txt @@ -183,4 +183,5 @@ found_key_recap_v3 = "В системных настройках обнаруж notfound_key_recap_v3_1 ="API ключи reCAPTCHA v3 не обнаружены." notfound_key_recap_v3_2 =" Вы можете установить их в разделе " notfound_key_recap_v3_3 ="Системные настройки" -demo_jqval_cap = "с jQuery Validation Plugin и reCAPTCHA v3" \ No newline at end of file +demo_jqval_cap = "Без Ajax, с jQuery Validation Plugin и reCAPTCHA v3" +demo_ajax_jqval_cap = "Ajax, с jQuery Validation Plugin и reCAPTCHA v3" \ No newline at end of file diff --git a/contactsnew/lang/ua.txt b/contactsnew/lang/ua.txt index 7325ecb..c803440 100644 --- a/contactsnew/lang/ua.txt +++ b/contactsnew/lang/ua.txt @@ -183,4 +183,5 @@ found_key_recap_v3 = "В системных настройках обнаруж notfound_key_recap_v3_1 ="API ключи reCAPTCHA v3 не обнаружены." notfound_key_recap_v3_2 =" Вы можете установить их в разделе " notfound_key_recap_v3_3 ="Системные настройки" -demo_jqval_cap = "с jQuery Validation Plugin и reCAPTCHA v3" \ No newline at end of file +demo_jqval_cap = "Без Ajax, с jQuery Validation Plugin и reCAPTCHA v3" +demo_ajax_jqval_cap = "Ajax, с jQuery Validation Plugin и reCAPTCHA v3" \ No newline at end of file diff --git a/contactsnew/templates/form_edit.tpl b/contactsnew/templates/form_edit.tpl index 8f488cf..2e80724 100644 --- a/contactsnew/templates/form_edit.tpl +++ b/contactsnew/templates/form_edit.tpl @@ -169,6 +169,7 @@ $smarty['_refresh'] = '{#refresh#}';