Forums

Calling two different javascripts in the one form

cite 14 Aug, 2007
Hi,

I currently call a validaton script as described in the Tutorials with the following line onSubmit="return checkForm(this)"

and a snipet of the code...

function checkForm(form)
{
if(form.Surname.value == "") {
alert("Please include your Surname !");
return false;
}
return true;
}

All works perfectly !

I would also like to include a script to insert the current date into the HTML email template I am using. The script is simple but I'm a little unsure of how to implement it using chronoforms.

<script type="text/javascript">

document.write(Date())

</script>

I've tried including the script in the Email Template section but no luck.

thanks.
GreyHead 14 Aug, 2007
Hi cite,

The e-mail is created on the server, not in your browser, so there's no JavaScript available at that stage.

The simplest way to put the date in is probably to put a hidden field in your form and give it a value of
value="<?php echo date(r) ?>"
The 'r' is a format code that you can change - see the PHP manual here for different options.

Bob<br><br>Post edited by: GreyHead, at: 2007/08/14 10:49
cite 16 Aug, 2007
Excellent, was a much better solution for me, thanks.
This topic is locked and no more replies can be posted.