Autamatically create article with form fields

greendragon 31 Jul, 2014
First, I beg your pardon if my ask was already done on this forum, I searched but I didn't find a good answer and some links to other posts no longer work.
I'd want to know if it's possible to automatically create a new article using form fields. I created a form to insert an article front end side and I want to use all the form field to automatically create a new article, without administrator intervention. I read that it's possible to use Custom Code action in On submit event, but it's possible to automatically create a new article?
Is there a tutorial that explain how to do it?
I'm completely new on Joomla and php programming, so I'm searching for something complete and easily undertood... if it exists!
Thanks...
Max_admin 31 Jul, 2014
Hi greendragon,

You can simply use the "submit article" action in v4, its under the Joomla actions section!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
greendragon 01 Aug, 2014
Hi Max,
I tested Submit article action, and it works perfectly. However, I need to get some form fields and use it create an article with a fixed layout. I thought to use Custom code to access fields and use it in the right way. Is it possible to do? Is it possible to automatically create article through the code in Custom code?
Thanks
GreyHead 01 Aug, 2014
Answer
Hi green dragon,

Yes you can do that. Add a Custom Code action before the Submit Action with some code in it like this:
<?php
$form->data['new_article'] = "
<p>Some text here</p>
<p>Some more text {$form->data['some_input_name']} more text</p>
<p>Even more text {$form->data['another_input_name']}</p>
";
?> 
This will work OK to merge standard text with form data. The main thing to watch is not to use any double quotes " in your text

Then add new_article in the introtext box of the Submit Article action.

Bob
greendragon 04 Aug, 2014
Thanks a lot Bob!
It works fine!!!
This topic is locked and no more replies can be posted.