I have a module in which the form in it fields which user fills in and via ajax the data is sent to the Helper module and there the material is added where necessary through the Cobalt API. From the main page where only my module and mod_cobalt_records have nothing else, and the data through the module is well added (all the fields from the form go where necessary). But if from the list of Cobalt articles, then after filling in the data (all the data are up to Helper), the title of the article is not created. Who knows why the Cobalt does not work correctly from the list of articles that the API works?
P.S. For russian lang http://www.mintjoomla.com/support/community-forum/user-item/5968-pavel8289/48-cobalt-8/8386-cobaltapi.html
Helper code
include_once JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_cobalt' . DIRECTORY_SEPARATOR . 'api.php';
.......
.......
.......
$apiCobalt = new CobaltApi();
$AddToDBresult = $apiCobalt->createRecord(
[
'title' => $full_name,
'access' => 1,
'published' => $published,
'alias' => translit($full_name)
],
7, //section
7, // type
[
38 => $last_name,
39 => $first_name,
40 => $middle_name,
24 => ['image' => $photo],
26 => $univer,
29 => $workplace,
35 => 'SUBORDINATE',
30 => $phone,
27 => $year,
28 => $degree,
31 => $position,
37 => $email_user
],// fields
[$cat_id]
);
The main module file
defined('_JEXEC') or die('Restricted access');
// Include the helper.
require_once __DIR__ . '/helper.php';
// Instantiate global document object
$doc = JFactory::getDocument();
$js = <<<JS
(function ($) {
$(document).on('click', '#payment-form input[type=submit]', function () {
if(
$('#contact_form #payment-lname').val() !== "" &&
$('#contact_form #payment-fname').val() !== "" &&
$('#contact_form #payment-mname').val() !== "" &&
$('#contact_form #payment-district').val() !== "" &&
$('#contact_form #payment-email').val() !== "" &&
$('#contact_form #payment-conditions').is(':checked')
)
{
$('#payment-form input[type=submit]').attr('disabled','');
/* Sivers (данные для передачи) - начало */
var form = $('#contact_form').get(0);
var formData = new FormData(form);
formData.set('option', 'com_ajax');
formData.set('module', 'enter_organition');
formData.set('format', 'raw');
/* Sivers (данные для передачи) - конец */
$.ajax({
type: 'POST',
processData: false,
contentType: false,
data: formData,
success: function (response) {
console.log(response);
$('#payment-finish').html(response);
$('#payment-finish input[type="image"]').trigger('click');
},
error: function (error) {
console.log(error);
$('#payment-finish').html(error);
}
});
return false;
}
else {
alert("Заполните все поля какие отмеченные * ");
}
});
})(jQuery)
JS;
$doc->addScriptDeclaration($js);
require(JModuleHelper::getLayoutPath('mod_enter_organition', $params->get('layout', 'default')));
?>
I have a module in which the form in it fields which user fills in and via ajax the data is sent to the Helper module and there the material is added where necessary through the Cobalt API. From the main page where only my module and mod_cobalt_records have nothing else, and the data through the module is well added (all the fields from the form go where necessary). But if from the list of Cobalt articles, then after filling in the data (all the data are up to Helper), the title of the article is not created. Who knows why the Cobalt does not work correctly from the list of articles that the API works?
P.S. For russian lang http://www.mintjoomla.com/support/community-forum/user-item/5968-pavel8289/48-cobalt-8/8386-cobaltapi.html
Helper code
The main module file