Joomla Article

Fido vel Fidel 18 Jan, 2016
Hi,
I have question about adding new article by CF 5.
I have form with 3 fields (textbox, textaera box, dropdown). Text Box is Article title, Textaera Box is Article content and dopdown is article category.
I want onSubmit that category of new article was takeing form dropdown value.
On Setup in Joomla Article setting is field for category ID, how to make that field take info about category ID from dropdown selection?

Regards,
Sebastian
GreyHead 19 Jan, 2016
Hi Sebastian,

As far as I can see the Joomla! Article action doesn't allow a dynamic Category ID so you would have to create the article, then use a Custom Code action to change the category to the one selected.

Bob

PS It would also be a fairly trivial hack to change the article action code to allow a dynamic catid. Replace this line
$article_data['catid'] = $config->get('catid', '');
with
if ( !empty( $form->data['catid'] ) ){
  $article_data['catid'] = $form->data['catid'];
} else {
  $article_data['catid'] = $config->get('catid', '');
}
Fido vel Fidel 20 Jan, 2016
Hi Bob,
Thanks for your reply, where I should put this Cotum Code?
And as I understood I have to change 'catid' to my dropdown Field ID as shown in the code below?

if ( !empty( $form->data['catid'] ) ){
  $article_data['catid'] = $form->data['fieldid'];
} else {
  $article_data['catid'] = $config->get('fieldid', '');
}


Regards,
Sebastian
Max_admin 25 Jan, 2016
The easy way is to use this code in a "custom code" action ABOVE the "Joomla Article" action:


<?php
$form->actions_config[77]["catid"] = $form->data['fieldid'];


Where 77 is the "action id", which is the number written in the action's header bar in blue.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.