You need to use a custom template, you can add your javascript to the form in that template:
Using Participants Database Custom Templates
Hello
I have tried to follow your documentation and not getting anywhere; I am not very good with php and javascript (more of a html girl)
This is the javascript that needs adding
<script language=”JavaScript”>function calculateAge(birthMonth, birthDay, birthYear)
{
todayDate = new Date();
todayYear = todayDate.getFullYear();
todayMonth = todayDate.getMonth();
todayDay = todayDate.getDate();
age = todayYear – birthYear;
if (todayMonth < birthMonth – 1)
{
age–;
}
if (birthMonth – 1 == todayMonth && todayDay < birthDay)
{
age–;
}
return age;
}</script>
and this is the supporting code that needs to go into the field named age
<script language=”JavaScript”>Date.prototype.ageLastBirthday = function(dob) { var cy = this.getFullYear(); var by = dob.getFullYear(); var db = new Date(1996,09,07); db.setFullYear(cy); var adj = (this-db<0) ? 1 : 0; return cy – by – adj; }</script>
<script type=”text/javascript”>
document.write(” ” + calculateAge(10,12,2010) + “” );
</script>
I am sure its something obivious I am doing wrong but any help would be most invaluable.
CC