• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Send Page Title and/or URL in email

Send Page Title and/or URL in email 16 years 8 months ago #4594

I'm trying to get my form to send the page title and URL in the subject or body. So far I have been able to use a \"script called on form process\" to send a separate email with the page title, but the script executes on display so I'm getting an email each time I hit a page containing the form module. I would love to be able to integrate the script so the $myPageTitle is sent with the RSForm email, not separately. Any ideas? Here is the script I'm using in \"script called on process\":
$myPageTitle = \"\";
$myPageTitle = $mainframe->_head['title'];
$myPageTitle = substr($myPageTitle, strlen($mosConfig_sitename) + 3, strlen($myPageTitle) - strlen($mosConfig_sitename) - 3);
 
echo $myPageTitle; 
 
mosMail(\"me@mydomain.com\",\"My Web Site Name\",\"me@mydomain.com\",$myPageTitle,\"The previous form result came from this page\");

Post edited by: Gremlin098, at: 2008/09/09 16:55<br><br>Post edited by: Gremlin098, at: 2008/09/09 16:57
The administrator has disabled public write access.

Re:Send Page Title and/or URL in email 16 years 7 months ago #4603

In order to keep the script from running when the form is displayed, you have to start it with something like:
if(isset($_POST['form']['submit'])) {
(if you don't have a button called \"submit\", replace that word with the name of your submit button or any field that is sure to have a value.) I don't know why RSForm doesn't already include that conditional or something similar, since the script is to be run only on form process, but it doesn't, so you have to do it.

As for sending the page title and URL in an email: I know that the RSForm notification email functionality sends a plain text email, not HTML, but most email clients will make a link out of anything they recognize as a URL. So I would think you could put the title and URL in a hidden field in the form (as well as the page title), and populate it either with the Default Value setting (I don't know if there is a way to access the mainframe object there or not) or Javascript in the \"script on form display\" that runs after the page is built. Then use the field placeholders in RSForm's \"Emails\" section to put it in the email body. Does that help, or am I not understanding what you want to do?
The administrator has disabled public write access.

Re:Send Page Title and/or URL in email 16 years 7 months ago #4604

No, that makes perfect sense. Unfortunately its way over my head as far as scripting is concerned. I'm currently working on the problem from another direction. I have a \"tell a friend\" module installed so now all I need to do is give the 'to' field a default value (my email address) and hide it. Should work like a charm, but doesn't append to the database which is only a minor problem for me.

I'm a little surprised that none of the form components I've tried send the page URL with the form results. Even if I don't necessarily need it, its always nice to know what users are looking at when they send you a message. Sometimes the message is so vague I'm not sure how to reply.
The administrator has disabled public write access.

Re:Send Page Title and/or URL in email 16 years 7 months ago #4606

If what you're after is a Tell a Friend email, then that approach is probably better anyway - if there is an extension specifically designed to do what you want (and it actually works, that is), that's usually a better choice than specialty code in something else. But...
Sometimes the message is so vague I'm not sure how to reply.
That statement makes it sound like you're talking about a Contact Us form rather than a Tell a Friend form. For Contact Us forms (I have a lot of them, on about six domains), I just make sure the subject line of the email (or the first line of the message body) is specific enough to tell me (or whoever else might be the POC for the site) where it came from - like \"Contact Us form submission from mysite.com\" or something like that. I don't need to know the URL of my own form page, as long as I know that's where the message came from.
The administrator has disabled public write access.

Re:Send Page Title and/or URL in email 16 years 7 months ago #4614

Yeah, I need a contact form. I run a real estate site and have a \"for more information on this property\" form on each property page. I was putting up a new RSForm for each page, but that was a pain. The stripped down tell-a-friend module should work much better since I can simply assign it to the property section instead of creating a new form for each page. I just need to add a couple of extra fields so, once again, I'm back to coding which I don't know very well. My guess is that it will be easier to add a field to an existing form than to pass the URL back through RSForm.<br><br>Post edited by: Gremlin098, at: 2008/09/10 16:38
The administrator has disabled public write access.

Re:Send Page Title and/or URL in email 16 years 7 months ago #4615

Ah, now I have some context to imagine what the challenge is. If the Tell A Friend functionality works out for you, great. But if you get stumped again, here's my thought on how it might work in RSForm: On the pages that show the real estate, have a small form (not RSForm, but just a little bit of code in a custom module or something - since you're using Joomla, you only have to write it once) whose \"action\" is the URL of the RSForm contact form. In that little module-based form, you would have just one hidden field and a submit button - the user would only see the button that says \"Ask for More Info\" or whatever. The hidden field would contain the URL of the page, or the ID number of the piece of real estate, or whatever you find most convenient (or you can have more than one hidden field if you have more than one thing you want to keep track of). In RSForm's script run on form display, you would hopefully be able to use PHP's $_POST or $_GET array (if you don't know what I mean, I can show you example code) to pick up the value of the hidden field and put it in yet another hidden field in that form, so that when the contact form is submitted, the email to you (and the database as well) would have the value from the original hidden field, identifying the page the user came from or the item they were looking at.

Keep in mind that I have not tried to do this kind of thing in Joomla, so I can't guarantee that there aren't any roadblocks. But it seems like it should work, and if I were doing a real estate site in Joomla, that's the approach I would probably try.<br><br>Post edited by: OsakaWebbie, at: 2008/09/10 17:17
The administrator has disabled public write access.

Re:Send Page Title and/or URL in email 16 years 6 months ago #5227

  • dmocca
  • dmocca's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 2
Hi, I am also interested in something like this.
Have you resolved it?
Thanks,
Damian
The administrator has disabled public write access.

Re:Send Page Title and/or URL in email 16 years 6 months ago #5228

Yeah, I got something working. You can try it out at http://1031trader.com on any of the Featured Properties in the left column. Just click the \"More Information' button.

Let me know if its something you can use and I'll send you the module files.<br><br>Post edited by: Gremlin098, at: 2008/10/23 18:28
The administrator has disabled public write access.

Re:Send Page Title and/or URL in email 16 years 6 months ago #5258

That looks like it's exactly what I need!

Would you be willing to share it?
You can send the files to: info(at)volunteeringecuador.info.

I would really appreciate it!

@ OsakaWebbie
What type of code would you exactly suggest? My PHP skills are 0 to none....

I am looking to prefill the email field with the email of the author in com_content
Also the subject line with the 'title' element from the com_content.

Check out the following link to see what I am working on:
www.volunteeringecuador.info/joomla/internships/blabla.html<br><br>Post edited by: tinus2003, at: 2008/10/24 21:16
The administrator has disabled public write access.

Re:Send Page Title and/or URL in email 16 years 6 months ago #5265

Sorry, login took me out of this thread so my answer to this posted in here:

http://www.rsjoomla.com/index.php/RSform-How-To/5264-Contact-Form-with-Page-URL.html
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!