Forums

Sending html code in a form

kunoichidee 05 Aug, 2010
Hello

I would like to have a form for the users of our site to send in embed codes for video's they want to see on the site. Now the form just ignores / omits all code entered in the form.

How do I make the form ignore it as html, and just reads it as text so we can receive it in our mailboxes as the embed code it should be?

Thanks for the help

Diana
GreyHead 06 Aug, 2010
Hi Diana,

Sorry, I don't know how you'd do that. It seems that the HTML is stripped even if I add it directly into the Email template :-(

Bob
kunoichidee 06 Aug, 2010
thx for looking into it!

i hope someone else does find a work around though... ?
I suspect there will be some coding that needs to be done...

I guess for now I will have to change it to making them send the location of the video, will be more work for me though...😟
nml375 10 Aug, 2010
Hi,
I believe the best workaround is to write the form data into a temporary file, which you then manually attach to the email. Something along these lines (used in the on submit - before email) should do the trick:
<?
$MyForm =& CFChronoForm::getInstance("formname");
$MyUploads =& CFUploads::getInstance($MyForm->formrow->id);
$config =& JFactory::getConfig();
$tmpfname = $config->getValue('config.tmp_path').DS.uniqid('txt');

$data =& JRequest::getVar('text_0', '', 'post', 'string', JREQUEST_ALLOWRAW);
if (JFile::write($tmpfname, $data)) {
  $MyUploads->attachment[] = $tmpfname;
}
?>


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