Create Content Items with ChronoForms

djordjew 10 Feb, 2010
Hello there,

I've already tried to use sample form located in download section, but my problem is different. I'll try to give simple explanation.

I have form with following fields:
textFieldA
textFieldB
textAreaC
dropDownD

I created form like this and I'm able to save data to table in my joomla database, for example MyTable.

Is it possible now to use data from MyTable and write them in jos_content table, where jos_content fields would be created as:
title = textFieldA + textFieldB
introtext = textAreaC + dropDownD

Section id and category id would be predefined.

Can anyone give me a hint is this possible or not.

Thanks in advance
GreyHead 10 Feb, 2010
Hi djordrew,

Yes that's possible.

You need to use the OnSubmit Before box* to pre-process the values. Here's a basic example:
<?php
$textfieldA = JRequest::getString('textfieldA', '', 'post');
$textfieldB = JRequest::getString('textfieldB', '', 'post');
$title = $textfieldA.$textfieldB;
JRequest::setVar('title', $title);
?>

Bob

* You must have Send Emails set to 'Yes' in the form General tab for this box to function.
djordjew 10 Feb, 2010
I get really strange error, please note it is JRqeuest and not JRequest
Fatal error: Class 'JRqeuest' not found


Any idea?
djordjew 10 Feb, 2010
ops sorry, I copied your typo 😶

Thanks GreyHead, I'll see what happens now😉
djordjew 10 Feb, 2010
Hi Bob,

I tried something like this, it looks like I'm doing something wrong.

Here is the code I used trying only to set article title, section and category:

<?php
$select1 = JRequest::getString('$select1', '', 'post');
$select2 = JRequest::getString('$select2', '', 'post');
$title = $select1.$select2;
JRequest::setVar('title', $title);
JRequest::setVar('sectionid', 5);
JRequest::setVar('catid', 23 );
JRequest::setVar('state', 0);
?>


Email sent contains all the data, but article created doesn't have article title, while sectionid and catid are set correctly.

Any idea where I'm doing wring?

Thanks in advance
GreyHead 10 Feb, 2010
Hi djordrew,

Mea culpa . . . there was another typo in there too - I left some $s in the wrong place. Should be
$select1 = JRequest::getString('select1', '', 'post');
$select2 = JRequest::getString('select2', '', 'post');

Bob

PS I corrected my earlier post.
djordjew 10 Feb, 2010
thanks Bob, I got it now😉
This topic is locked and no more replies can be posted.