Forums

get today and add to email

angelaus 17 Nov, 2009
Hi

I want to get form submit date and mail it with the form email ..

how Can I do this..


( I have a mail template and todays date will be printed as "application date : 17/11/2009" )
nml375 17 Nov, 2009
Hi angelaus,
I'd add something like this to "on submit - before email":
<?
$date =& JFactory::getDate();
JFactory::setVar('date', $date->toFormat('%e/%m/%Y');
?>


Then, in your email template, add something like this:
Application submitted at: {date}

/Fredrik
angelaus 18 Nov, 2009
it didnt work.

I put the code to before email part. and put just {date} on the top of email. it gives {date} not actual date.

by the way. I have a text area drives me crazy..

it is birth date : textbox
<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label" style="width: 150px;">Doğum Tarihi :</label>
    <input class="cf_inputbox required " maxlength="150" size="30" title="gg/aa/yyy Şeklinde olmalı" id="text_22" name="ydogum" type="text" />
  <a class="tooltiplink" onclick="return false;"><img height="16" border="0" width="16" class="tooltipimg" alt="" src="components/com_chronocontact/css/images/tooltip.png"/></a>
				<div class="tooltipdiv">Doğum Tarihi : :: Lütfen Doğum Tarihinizi "gg/aa/yyyy" Şeklinde Giriniz.</div>
  </div>
  <div class="cfclear"> </div>
</div>



it works normal in FF but gives DATEPICKER in internet explorer. I couldnt solve it..

translations:
dogum --> birth
tarihi --> date
gg/aa/yyyy -> dd/mm/yyyy
angelaus 18 Nov, 2009
problem with datepicker just with IE7


ie8 and firefox are fine..
GreyHead 18 Nov, 2009
Hi angelaus,

Because of the sequence in which ChronoForms creates e-mails you can't set a value in the OnSubmit Before box and use it in the email template.

But you don't need to. Switch off the HTML editor in the Email Setup Properties box then add the code directly to the template:
<?php
$date =& JFactory::getDate();
echo "<p>Application Date: ".$date->toFormat('%e/%m/%Y')."</p>";
?>


I suspect that the IE/FF problem may be becasue the input id is not the same as the name. Make the code id="ydogum" name="ydogum"

Bob
nml375 18 Nov, 2009
Bob,
I must've forgotten that :/

Nevertheless, there's an error in my code. The setVar method doesn't exists in the JFactory class, but the JRequest. Guess I'm just having one of 'those' days...

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