Javascript and Form

kootjoo 04 Feb, 2010
Hi,

I have the following form which function without any problems as a plain HTML form:

<script type="text/javascript">
function totalprice()
{
var a = document.form1.lengte.value
var b = document.form1.diepte.value

var oppervlakte = (a * b)/100
 
var c = oppervlakte*5.50
 
document.form1.total.value = c
}
</script>
 
 
</head>
<body>
<form action="bereken.php" method="post" name="form1">
  <p>Lengte in centimeter:
  <input name="lengte" id="lengte" onblur="totalprice();" value="100" size="10">
  </p>
  <p>Diepte in centimeter: 
    <input name="diepte" id="diepte" onblur="totalprice();" value="50" size="10"><br>
  </p>
  <p>Uw prijs:
    <input name="total" id="total" size="10" readonly=true><br>
    
  </p>
</form>


When I try to implement this in Chronoforms (by splitting the form html and code) I get the following error:

Message: 'document.form1.lengte' is empty or not an object

In Chronoforms the form is also called form1.

Can you give me any tips on how to solve this?
Thanks,
KooTjoo
GreyHead 04 Feb, 2010
Hi KootJoo,

If you check the page HTML with View Source you'll find that the form is no longer called 'form1' but 'ChronoContact_form1'

Bob
kootjoo 04 Feb, 2010
Thanks and sorry that I overlooked this. It works!

I wil inmediately get a paid subscription.

Best regards,
KooTjoo
This topic is locked and no more replies can be posted.