Forums

Form sends page title from Referring Page

nicksab 16 May, 2013
Hello,

I have a basic form on my site http://investinginmiami.com/ at the bottom of each page. When a user sends me an email through the form I would like to have it include the title of the page they were on. I searched through the forum and found 2 similar entries, but didn't have any luck getting them to work.

I am using the wizard to create my forms with a validated copy of chronoforms version 4.0 on a Joomla 3.1.1 website.
nicksab 18 May, 2013
Hi Bob,

Thanks for your suggestion, it worked, and then some :wink: In the email, I am receiving the title of the page but immediately after the title is some code...kind of like the following... where TITLE is the title of my page:

TITLEgetTitle(); ?>' />
GreyHead 18 May, 2013
Hi nicksab,

Looks like there may be a typo with a quote or space - exactly what code have you used?

Bob
nicksab 18 May, 2013
Here's what I have plugged in:

<?php
$doc =& JFactory::getDocument();
?>
<input type='hidden' name='page_title' id='page_title' value='<?php echo $doc->getTitle(); ?>' />
GreyHead 19 May, 2013
Hi nicksab,

Stefano (in another thread) is also having problems with this. Please try entering it into a Custom Element element (from the Advanced elements group) in the Preview box.

Bob
nicksab 20 May, 2013
I already had it plugged into the "Code" section of a "Custom Element" in the "Preview" tab of the "Form Wizard"

nicksab 22 May, 2013
any luck on this one?
GreyHead 25 May, 2013
Hi nicksab,

I tested this again and it works OK:
<?php
$doc =& JFactory::getDocument();
?>
<input type='hidden' name='page_title' id='page_title' value='<?php echo $doc->getTitle(); ?>' />
<input type='hidden' name='page_base' id='page_base' value='<?php echo $doc->getBase(); ?>' />

Giving this in the page source:
<input id="page_title" type="hidden" value="Home" name="page_title">
<input id="page_base" type="hidden" value="http://example.com/index.php/2-uncategorised/2-test-get-doc-info" name="page_base">

The only difference I spot is that I have the Pure Code box ticked.

Bob
nicksab 30 May, 2013
Thanks for getting back to me. I checked the pure code box and I am still receiving the extra code in the email. It's ok I will just tell the client to disregard the extra code.

I do have another problem though.

I will create a new thread for it.
This topic is locked and no more replies can be posted.