Buy Now
Sign in

Joomla Article

Fido vel Fidel , January 18 2016
Fido vel Fidel
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
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', '');
}
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
Fido vel Fidel
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
admin
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
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!