Forums

Trying to get content from form into article

tokenring 09 Jun, 2009
I've looked around and tried a few things on the test site, but I'm stuck on how to do this. basically I have a few forms that users fill out which creates standard articles in Joomla.

However, I don't know how to get this text

{youtube}FokKtuzIkM8{/youtube}

that the user puts in a textbox into the article that is created. I have to manually take that line (from the e-mail notification) and manually add it to the article before it is published.

what is the easiest way to have this inserted into the article right from the form??? I know the HTML source is the answer, but I'm a bit stuck.

:-)
GreyHead 10 Jun, 2009
Hi tokenring,

It probably needs some trial and error. Have you tried building it with entities {youtube} . . .?

Bob
tokenring 10 Jun, 2009
I'll give that a whirl tonight again... I saw that mentioned, but I couldn't get it. Thanks for the reply!
tokenring 18 Aug, 2009
I'm still stuck on this...😟

basically there is just one string of text that I want to get from the form into the article that I can't just figure out right now. I can get the autor-alias, fulltext, link... but I can't capture this string

[youtube]bla-bla-bla[/youtube]


what I have to do now is copy and paste this string from the e-mail notification I get into the article and then publish it. If this is easier than I am making it out to be, can someone shed some light???

Thanks guys!

Aaron
tokenring 29 Apr, 2010
can someone show me the thread that details how to capture the text from ALL of the textboxes and to have it put into the article (automatically).

Thanks,
Aaron
trenchard 11 May, 2010
How do we dump all of the form submissions (records from the linked table) into a table that shows up in a single/secure article.
GreyHead 12 May, 2010
Hi Trenchard,

You can do this with ChronoConnectivity to get a list to display in a site page.

To get the list into a Joomla article you'll need to write the PHP to extract the data from the database, format it and save it back to the jos_content table.

Bob
tokenring 19 Aug, 2010
I think I've got a bit closer.

When you edit a form you and click on the "autogenerated code" tab you see the text of one of php files (config?) that generates the content of the article being submitted... I believe.

I know you can't save the box when you edit it (says it's pointless) however that file probably can be edited in the file system to do what you want. Is this right?

this part of the code made me think so.

$row =& JTable::getInstance("content", "Table");
srand((double)microtime()*10000);
$inum = "I" . substr(base64_encode(md5(rand())), 0, 16).md5(uniqid(mt_rand(), true));
JRequest::setVar( "recordtime", JRequest::getVar( "recordtime", date("Y-m-d")." - ".date("H:i:s"), "post", "string", "" ));



Aaron
tokenring 19 Aug, 2010
also, there is a textbox for the user to enter embedded code, and it seems to not show up in the e-mails that are generated from the form. I suppose it is being executed somehow??


Aaron
GreyHead 19 Aug, 2010
Hi Aaron,

I think that Fredrik (nml375) posted a way to do this in the last week or two. I forget exactly what it was though.

Bob
tokenring 19 Aug, 2010
are you replying the first or last comment i made?
nml375 19 Aug, 2010
Hi,
The code shown in the autogenerated section is not stored in any files on the site, but in the very same DB record that stores all the other information of your form. This code is re-generated every time you save your form, so I would not recommend trying to edit it in the database record.

Instead, you can use the "on submit - before email" input to run code prior the "autogenerated code", which in essence, allows you to create the needed data and store it as a form field value (using the JRequest::set() classmethod). Looking at the submitcontent demo-form should give you a few more hints as to setting the DB Connection up properly against the #__content table, and which fields to use.

/Fredrik
tokenring 20 Aug, 2010
Thanks Fredrick. I'll look at that today. I'm sure it will take a bit because I don't want to mess it up. I'll do it on my test site first.

Is there another way this is done by default? When a user submits the form now the [description] textarea is entered into the article, however I don't see a line that details that in the onsubmit before/after???


Aaron
tokenring 20 Aug, 2010

also, there is a textbox for the user to enter embedded code, and it seems to not show up in the e-mails that are generated from the form. I suppose it is being executed somehow??


Aaron



I can't find the way to escape this???
tokenring 23 Aug, 2010

Hi,
The code shown in the autogenerated section is not stored in any files on the site, but in the very same DB record that stores all the other information of your form. This code is re-generated every time you save your form, so I would not recommend trying to edit it in the database record.

Instead, you can use the "on submit - before email" input to run code prior the "autogenerated code", which in essence, allows you to create the needed data and store it as a form field value (using the JRequest::set() classmethod). Looking at the submitcontent demo-form should give you a few more hints as to setting the DB Connection up properly against the #__content table, and which fields to use.

/Fredrik



where in the demo form am I looking? The on submit before and after e-mail text boxes have nothing in them that I'm looking for? Where exactly are you talking???
btw - there is a typo in the demo form (e-maisl instead of e-mails)

Aaron
nml375 23 Aug, 2010
Hi Aaron,
Sorry for the delay.
You should be able to find this in the "on submit" section of the submitcontent form:
<?php
$_POST['catid'] = '32';
$_POST['id'] = '';
$_POST['sectionid'] = '9';
$_POST['state'] = '0';
$_POST['created'] = date("Y-m-d H:i:s");
?>

Further, reading the form html reveals the following form inputs:
[list]
  • title

  • fulltext

  • created_by_alias
  • [/list]

    There are a few other properties you could control as well, when creating the article, though I don't remember them all right now (if you've got phpmyadmin or similar db-tools, check the design of the jos_content table..).

    The rest that is needed, is merely the DB Connection with the jos_content table...

    /Fredrik
    tokenring 23 Aug, 2010
    awesome. I knew that those lines put the article in the correct section, category and state but I didn't know you can control the content. Thanks for your help and it wasn't delayed at all ;-)

    Aaron
    This topic is locked and no more replies can be posted.