Click to See Complete Forum and Search --> : Simple JavaScript Form Help - Please Help!


mtcmedia
03-02-2003, 09:03 AM
Hi All,

I am trying to write a simple javascript form. I want it so that when someone ticks a checkbox, it will then update another field by multiplying two other fields together. Hope that makes sence, here is what I have so far:

<script language="JavaScript">

function validate_form(){

//=========================================================
//Begin Work Out Cost Box 1

if (beaver_form.item1.checked)
{
document.beaver_form.cost1.value = ('£'+(document.beaver_form.qu1.value*document.beaver_form.pi1.value)+'.00');
return false;

}

//End Work Out Cost Box 1
//=========================================================


return (true);
}

</script>

The field I want to update, cost1 is defined as:

<INPUT size=7 name=cost1>

What am I doing wrong? I am currently trying to update the field when the submit button is clicked, but i would prefer if the cost1 field updated as soon as they ticked the box. Is this possible? Thank you in advance, and sorry if this is a stupid question!

mtcmedia
03-02-2003, 11:35 AM
Figured it out, thanks dave! Im onto my next problem now!! haha