Auto attach meta-tags or page-name to a form-mail

stoffhausen 03 Dec, 2014
hi there!
My client asked me, if it's possible to create one simple form which is displayed on different pages (I know this is not the problem 😉 ). But: Is there a way to auto-attach the actual page-title, so my customer knows on which page the visitor filled out the form?

this would be so great! thank you for your tips!
greetings from austria
chris!
scagnoz 23 Dec, 2014
Hi Bob,
can you explain why inserting the code
<?php
$doc =& JFactory::getDocument();
?>
<input type='hidden' name='page_title' id='page_title' value='<?php echo $doc->getTitle(); ?>' />

on a pure code custom field gives me back this error?

Fatal error: Call to undefined method JDocumentHTML::_() in /membri/wta/administrator/components/com_chronoforms5/chronoforms/actions/html/html.php on line 307

Unpublishing the form solves the problem
Thank you in advance!
GreyHead 24 Dec, 2014
Hi scagnoz,

Hmmm . . . it looks as though Max has use $doc for an internal ChronoForms variable in that file - it maybe that the two are getting mixed up. Please try this version instead, it just uses $jdoc instead of $doc.
<?php
$jdoc = JFactory::getDocument();
?>
<input type='hidden' name='page_title' id='page_title' value='<?php echo $jdoc->getTitle(); ?>' />

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